[jboss-cvs] jboss-seam/src/main/org/jboss/seam/util ...
Gavin King
gavin.king at jboss.com
Sat Sep 23 12:30:11 EDT 2006
User: gavin
Date: 06/09/23 12:30:11
Modified: src/main/org/jboss/seam/util Persistence.java
Log:
use Hibernate isDirty method
Revision Changes Path
1.2 +20 -1 jboss-seam/src/main/org/jboss/seam/util/Persistence.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: Persistence.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/util/Persistence.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- Persistence.java 13 Jul 2006 01:00:27 -0000 1.1
+++ Persistence.java 23 Sep 2006 16:30:11 -0000 1.2
@@ -10,7 +10,26 @@
public static void setFlushModeManual(EntityManager entityManager)
{
+ if (entityManager instanceof Session)
+ {
( (Session) entityManager.getDelegate() ).setFlushMode(FlushMode.NEVER);
}
+ else
+ {
+ throw new IllegalArgumentException("FlusMode.MANUAL only supported for Hibernate EntityManager");
+ }
+ }
+
+ public static boolean isDirty(EntityManager entityManager)
+ {
+ if (entityManager instanceof Session)
+ {
+ return ( (Session) entityManager.getDelegate() ).isDirty();
+ }
+ else
+ {
+ return true; //best we can do!
+ }
+ }
}
More information about the jboss-cvs-commits
mailing list