|
From: <one...@us...> - 2003-01-22 13:09:22
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate
In directory sc8-pr-cvs1:/tmp/cvs-serv17676/sf/hibernate
Modified Files:
Interceptor.java hibernate-mapping-1.1.dtd
hibernate-mapping-2.0.dtd
Log Message:
fixed a problem with unsaved-value attribute not being recognized for composite-id
added Interceptor.isUnsaved()
made save() aware of proxies
Index: Interceptor.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/Interceptor.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** Interceptor.java 5 Jan 2003 02:11:19 -0000 1.3
--- Interceptor.java 22 Jan 2003 13:09:19 -0000 1.4
***************
*** 41,45 ****
*/
public boolean onFlushDirty(Object entity, Serializable id, Object[] currentState, Object[] previousState, String[] propertyNames, Type[] types);
- //public void onPostFlush(Object entity, Serializable id, Object[] currentState, String[] propertyNames, Type[] types);
/**
* Called before an object is saved. The interceptor may modify the <tt>state</tt>, which will be used for
--- 41,44 ----
***************
*** 62,65 ****
--- 61,76 ----
*/
public void postFlush(Iterator entities);
+
+ /**
+ * Called when a transient entity is passed to <tt>saveOrUpdate()</tt>. The return value determines
+ * <ul>
+ * <li><tt>Boolean.TRUE</tt> - the entity is passed to <tt>save()</tt>, resulting in an <tt>INSERT</tt>
+ * <li><tt>Boolean.FALSE</tt> - the entity is passed to <tt>update()</tt>, resulting in an <tt>UPDATE</tt>
+ * <li><tt>null</tt> - Hibernate uses the <tt>unsaved-value</tt> mapping to determine if the object is unsaved
+ * </ul>
+ * @param entity a transient entity
+ * @return Boolean
+ */
+ public Boolean isUnsaved(Object entity);
}
Index: hibernate-mapping-1.1.dtd
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/hibernate-mapping-1.1.dtd,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** hibernate-mapping-1.1.dtd 13 Jan 2003 08:57:43 -0000 1.3
--- hibernate-mapping-1.1.dtd 22 Jan 2003 13:09:19 -0000 1.4
***************
*** 56,60 ****
<!ATTLIST id type CDATA #IMPLIED>
<!ATTLIST id length CDATA #IMPLIED>
! <!ATTLIST id unsaved-value CDATA "any"> <!-- any|none|null|"value" -->
<!-- A composite key may be modelled by a java class with a property for each
--- 56,60 ----
<!ATTLIST id type CDATA #IMPLIED>
<!ATTLIST id length CDATA #IMPLIED>
! <!ATTLIST id unsaved-value CDATA "any"> <!-- any|none|null|0|-1|.... -->
<!-- A composite key may be modelled by a java class with a property for each
***************
*** 65,69 ****
<!ATTLIST composite-id class CDATA #IMPLIED>
<!ATTLIST composite-id name CDATA #IMPLIED>
! <!ATTLIST composite-id unsaved-value (any|none|null) "any"> <!-- default: any -->
<!-- Polymorphic data requires a column holding a class discriminator value. This
--- 65,69 ----
<!ATTLIST composite-id class CDATA #IMPLIED>
<!ATTLIST composite-id name CDATA #IMPLIED>
! <!ATTLIST composite-id unsaved-value (any|none) "any">
<!-- Polymorphic data requires a column holding a class discriminator value. This
Index: hibernate-mapping-2.0.dtd
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/hibernate-mapping-2.0.dtd,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** hibernate-mapping-2.0.dtd 19 Jan 2003 11:47:07 -0000 1.8
--- hibernate-mapping-2.0.dtd 22 Jan 2003 13:09:19 -0000 1.9
***************
*** 53,57 ****
<!ATTLIST id type CDATA #IMPLIED>
<!ATTLIST id length CDATA #IMPLIED>
! <!ATTLIST id unsaved-value CDATA "null"> <!-- any|none|null|"value" -->
<!-- A composite key may be modelled by a java class with a property for each
--- 53,57 ----
<!ATTLIST id type CDATA #IMPLIED>
<!ATTLIST id length CDATA #IMPLIED>
! <!ATTLIST id unsaved-value CDATA "null"> <!-- any|none|null|0|-1|... -->
<!-- A composite key may be modelled by a java class with a property for each
***************
*** 62,66 ****
<!ATTLIST composite-id class CDATA #IMPLIED>
<!ATTLIST composite-id name CDATA #IMPLIED>
! <!ATTLIST composite-id unsaved-value (any|none|null) "any"> <!-- default: any -->
<!-- Polymorphic data requires a column holding a class discriminator value. This
--- 62,66 ----
<!ATTLIST composite-id class CDATA #IMPLIED>
<!ATTLIST composite-id name CDATA #IMPLIED>
! <!ATTLIST composite-id unsaved-value (any|none) "none">
<!-- Polymorphic data requires a column holding a class discriminator value. This
|