Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] JPA on GlassfishV3 prelude with Updateproblem

That is odd, what database are you using?  In some databases null = null is
true, but in some it is not for some very odd reason.

By default EclipseLink caches the generated update SQL, to avoid
regenerating every single time.  You can disable this using a
DescriptorCustomizer.

descriptor.getQueryManager().setUpdateCallCacheSize(0); 


Martin.Berner wrote:
> 
> Hello,
> I'm trying to update an Entity with JPA true EclipseLink on Glassfish. 
> I set OptimisticLocking(type=OptimisticLockingType.ALL_COLUMNS).
> If Glassfish is freshli started, the Update is OK produce the Fallowing
> SQL:
> UPDATE GESTHO.T_ROLE SET ROLE_LOCK = ? WHERE ((ROLE_ID = ?) AND
> ((((((ROLE_NAME = ?) AND (CRE_DAT = ?)) AND (CRE_KURZZ = ?)) AND (MUT_DAT
> = ?)) AND (MUT_KURZZ = ?)) AND (ROLE_LOCK IS NULL)))
> bind => [null, 10, mr, 2009-04-14 12:07:33.0, BM, 2009-04-21 10:26:58.0,
> BM]|#]
> respectivly:
> UPDATE GESTHO.T_ROLE SET ROLE_LOCK = ? WHERE ((ROLE_ID = ?) AND
> ((((((ROLE_NAME = ?) AND (CRE_DAT = ?)) AND (CRE_KURZZ = ?)) AND (MUT_DAT
> = ?)) AND (MUT_KURZZ = ?)) AND (ROLE_LOCK = ?)))
> bind => [null, 10, mr, 2009-04-14 12:07:33.0, BM, 2009-04-21 10:26:58.0,
> BM, 3008-08-22 08:26:58.0]|#]
> 
> But when I do an other Update of the Same Entity it results in a SQL like:
> UPDATE GESTHO.T_ROLE SET ROLE_LOCK = ? WHERE ((ROLE_ID = ?) AND
> ((((((ROLE_NAME = ?) AND (CRE_DAT = ?)) AND (CRE_KURZZ = ?)) AND (MUT_DAT
> = ?)) AND (MUT_KURZZ = ?)) AND (ROLE_LOCK = ?)))
> bind => [3008-08-22 08:42:48.942, 10, mr, 2009-04-14 12:07:33.0, BM,
> 2009-04-21 10:41:09.0, BM, null]|#]
> wich throws an OptimisticLockException in order the update never affect
> any rows becose "Collum = NULL" is never true;
> 
> I think it's a Caching problem, I also try to manipulate the Caching by
> CahingAnnotation on the Entity and in the persistence.xml without any
> visual effects.
> 
> 
> 


-----
---
http://wiki.eclipse.org/User:James.sutherland.oracle.com James Sutherland 
http://www.eclipse.org/eclipselink/
 EclipseLink ,  http://www.oracle.com/technology/products/ias/toplink/
TopLink 
Wiki:  http://wiki.eclipse.org/EclipseLink EclipseLink , 
http://wiki.oracle.com/page/TopLink TopLink 
Forums:  http://forums.oracle.com/forums/forum.jspa?forumID=48 TopLink , 
http://www.nabble.com/EclipseLink-f26430.html EclipseLink 
Book:  http://en.wikibooks.org/wiki/Java_Persistence Java Persistence 
-- 
View this message in context: http://www.nabble.com/JPA-on-GlassfishV3-prelude-with-Updateproblem-tp23156709p23156932.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.



Back to the top