Update of /cvsroot/hibernate/Hibernate/cirrus/hibernate/type
In directory usw-pr-cvs1:/tmp/cvs-serv20016/hibernate/type
Modified Files:
TypeFactory.java
Log Message:
for normalized table mappings, only update the tables that have dirty properties
Index: TypeFactory.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate/cirrus/hibernate/type/TypeFactory.java,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -d -r1.20 -r1.21
*** TypeFactory.java 5 Oct 2002 09:33:42 -0000 1.20
--- TypeFactory.java 5 Nov 2002 11:48:08 -0000 1.21
***************
*** 176,182 ****
/**
* Return <tt>-1</tt> if non-dirty, or the index of the first dirty value otherwise
*/
! public static int findDirty(Type[] types, Object[] x, Object[] y, Object owner, SessionFactoryImplementor factory) throws HibernateException {
for (int i=0; i<types.length; i++) {
if ( types[i].isDirty( x[i], y[i], owner, factory ) ) {
--- 176,205 ----
/**
+ * Determine if any of the given field values are dirty, returning an array containing indexes of
+ * the dirty fields or <tt>null</tt> if no fields are dirty.
+ */
+ public static int[] findDirty(Type[] types, Object[] x, Object[] y, Object owner, SessionFactoryImplementor factory) throws HibernateException {
+ int[] results = null;
+ int count = 0;
+ for (int i=0; i<types.length; i++) {
+ if ( types[i].isDirty( x[i], y[i], owner, factory ) ) {
+ if (results==null) results = new int[ types.length ];
+ results[count++]=i;
+ }
+ }
+ if (count==0) {
+ return null;
+ }
+ else {
+ int[] trimmed = new int[count];
+ System.arraycopy(results, 0, trimmed, 0, count);
+ return trimmed;
+ }
+ }
+
+ /**
* Return <tt>-1</tt> if non-dirty, or the index of the first dirty value otherwise
*/
! /*public static int findDirty(Type[] types, Object[] x, Object[] y, Object owner, SessionFactoryImplementor factory) throws HibernateException {
for (int i=0; i<types.length; i++) {
if ( types[i].isDirty( x[i], y[i], owner, factory ) ) {
***************
*** 185,189 ****
}
return -1;
! }
}
--- 208,212 ----
}
return -1;
! }*/
}
|