Skip to content

Commit

Permalink
Update hibernate to 3.6.1-Final
Browse files Browse the repository at this point in the history
  • Loading branch information
guillaumebort committed Mar 25, 2011
1 parent be9c944 commit 0d257ab
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 51 deletions.
2 changes: 1 addition & 1 deletion framework/dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ require: &allDependencies
- org.bouncycastle -> bcprov-jdk15 1.45
- org.codehaus.groovy -> groovy-all 1.7.7
- org.eclipse.jdt.core 3.6.0
- org.hibernate -> hibernate-core 3.6.0.Final
- org.hibernate -> hibernate-core 3.6.1.Final
- org.hibernate -> hibernate-commons-annotations 3.2.0.Final
- org.hibernate -> hibernate-entitymanager 3.6.0.Final
- org.hibernate.javax.persistence -> hibernate-jpa-2.0-api 1.0.0.Final
Expand Down
Binary file not shown.
98 changes: 49 additions & 49 deletions framework/patches/hibernate-3.6.x.Final.patch
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
--- project/core/src/main/java/org/hibernate/EmptyInterceptor.java 2008-07-30 11:46:34.000000000 +0200
+++ project/core/src/main/java/org/hibernate/EmptyInterceptor.java 2010-04-08 21:07:24.000000000 +0200
@@ -112,10 +112,10 @@
return sql;
}
return sql;
}

- public void onCollectionRemove(Object collection, Serializable key) throws CallbackException {}
+ public boolean onCollectionRemove(Object collection, Serializable key) throws CallbackException { return true; }
Expand All @@ -12,71 +12,71 @@

- public void onCollectionUpdate(Object collection, Serializable key) throws CallbackException {}
+ public boolean onCollectionUpdate(Object collection, Serializable key) throws CallbackException { return true; }

}
\ No newline at end of file

--- project/core/src/main/java/org/hibernate/Interceptor.java 2008-07-30 11:46:34.000000000 +0200
+++ project/core/src/main/java/org/hibernate/Interceptor.java 2010-04-08 21:06:52.000000000 +0200
@@ -84,15 +84,15 @@
/**
* Called before a collection is (re)created.
*/
/**
* Called before a collection is (re)created.
*/
- public void onCollectionRecreate(Object collection, Serializable key) throws CallbackException;
+ public boolean onCollectionRecreate(Object collection, Serializable key) throws CallbackException;
/**
* Called before a collection is deleted.
*/
/**
* Called before a collection is deleted.
*/
- public void onCollectionRemove(Object collection, Serializable key) throws CallbackException;
+ public boolean onCollectionRemove(Object collection, Serializable key) throws CallbackException;
/**
* Called before a collection is updated.
*/
/**
* Called before a collection is updated.
*/
- public void onCollectionUpdate(Object collection, Serializable key) throws CallbackException;
+ public boolean onCollectionUpdate(Object collection, Serializable key) throws CallbackException;
/**
* Called before a flush
*/
/**
* Called before a flush
*/

--- project/core/src/main/java/org/hibernate/event/def/AbstractFlushingEventListener.java 2010-03-10 03:25:04.000000000 +0100
+++ project/core/src/main/java/org/hibernate/event/def/AbstractFlushingEventListener.java 2010-04-08 21:06:14.000000000 +0200
@@ -140,7 +140,28 @@
for ( int i=0; i<size; i++ ) {
Map.Entry me = list[i];
EntityEntry entry = (EntityEntry) me.getValue();
- Status status = entry.getStatus();
+ Status status = entry.getStatus();
for ( int i=0; i<size; i++ ) {
Map.Entry me = list[i];
EntityEntry entry = (EntityEntry) me.getValue();
- Status status = entry.getStatus();
+ Status status = entry.getStatus();
+
+ // This entity will be saved?
+ boolean willBeSaved = true;
+ try {
+ Object o = me.getKey();
+ Class c = o.getClass();
+ Class jpaBase = Class.forName("play.db.jpa.JPABase");
+ while(!c.equals(Object.class)) {
+ if(c.equals(jpaBase)) {
+ willBeSaved = (Boolean)(jpaBase.getDeclaredField("willBeSaved").get(o));
+ break;
+ }
+ c = c.getSuperclass();
+ }
+ if(!willBeSaved) {
+ continue;
+ }
+ try {
+ Object o = me.getKey();
+ Class c = o.getClass();
+ Class jpaBase = Class.forName("play.db.jpa.JPABase");
+ while(!c.equals(Object.class)) {
+ if(c.equals(jpaBase)) {
+ willBeSaved = (Boolean)(jpaBase.getDeclaredField("willBeSaved").get(o));
+ break;
+ }
+ c = c.getSuperclass();
+ }
+ if(!willBeSaved) {
+ continue;
+ }
+ } catch(Exception e) {
+ e.printStackTrace();
+ }
+
if ( status == Status.MANAGED || status == Status.SAVING || status == Status.READ_ONLY ) {
cascadeOnFlush( session, entry.getPersister(), me.getKey(), anything );
}
+ e.printStackTrace();
+ }
+
if ( status == Status.MANAGED || status == Status.SAVING || status == Status.READ_ONLY ) {
cascadeOnFlush( session, entry.getPersister(), me.getKey(), anything );
}

--- project/core/src/main/java/org/hibernate/event/def/AbstractFlushingEventListener.java 2010-03-10 03:25:04.000000000 +0100
+++ project/core/src/main/java/org/hibernate/event/def/AbstractFlushingEventListener.java 2010-04-08 21:06:14.000000000 +0200
@@ -255,39 +255,42 @@
CollectionEntry ce = (CollectionEntry) me.getValue();
CollectionEntry ce = (CollectionEntry) me.getValue();

if ( ce.isDorecreate() ) {
if ( ce.isDorecreate() ) {
- session.getInterceptor().onCollectionRecreate( coll, ce.getCurrentKey() );
- actionQueue.addAction(
- new CollectionRecreateAction(
Expand All @@ -95,9 +95,9 @@
+ session
+ )
+ );
+ }
}
if ( ce.isDoremove() ) {
+ }
}
if ( ce.isDoremove() ) {
- session.getInterceptor().onCollectionRemove( coll, ce.getLoadedKey() );
- actionQueue.addAction(
- new CollectionRemoveAction(
Expand All @@ -119,8 +119,8 @@
+ )
+ );
+ }
}
if ( ce.isDoupdate() ) {
}
if ( ce.isDoupdate() ) {
- session.getInterceptor().onCollectionUpdate( coll, ce.getLoadedKey() );
- actionQueue.addAction(
- new CollectionUpdateAction(
Expand All @@ -142,6 +142,6 @@
+ )
+ );
+ }
}
}

}
}
2 changes: 1 addition & 1 deletion framework/patches/hibernate-3.6.x.Final.patch.README
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
----
Download Hibernate 3.6.0.Final source code, apply the patch, and build with maven (good luck)
Download Hibernate 3.6.1.Final source code, apply the patch, and build with maven (good luck)
----

DRY RUN -> patch --dry-run -p0 -i ../hibernate-3.6.x.Final.patch
Expand Down

0 comments on commit 0d257ab

Please sign in to comment.