-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 7 posts ] 
Author Message
 Post subject: Optimistic locking with joined subclasses
PostPosted: Sun Sep 03, 2006 9:32 am 
Newbie

Joined: Fri Apr 21, 2006 10:32 pm
Posts: 3
Hi!
I'm using Hibernate 3.1.3 and i'm having a problem with optimistic locking.
I hava a mapping with a joined sublcass.
The parent class is configured with the optimistic-locking attribute in 'all'
and the joined subclass is configured with the dynamic-update attribute in 'true'.

When I run a test case, i'm getting this exception

Caused by: org.hibernate.MappingException: optimistic-lock attribute not supported for joined-subclass mappings: com.np.iaso.mamo.model.PaqueteSuelto
at org.hibernate.persister.entity.JoinedSubclassEntityPersister.<init>(JoinedSubclassEntityPersister.java:110)
at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:58)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:216)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1176)
at com.np.iaso.


I didn't found in the documentation any info related to optimistic locking in joined subclasses. Is it supported?

Thanks a lot and sorry for my english!


Top
 Profile  
 
 Post subject:
PostPosted: Sun Sep 03, 2006 9:39 am 
Newbie

Joined: Fri Apr 21, 2006 10:32 pm
Posts: 3
Some more info.
The optimistic-lock with 'version' is it supported, but i'm not able to use this mode because other applications have access to the same database and don't know how to handle version numbers or even timestamp.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 13, 2006 6:04 pm 
Newbie

Joined: Mon Nov 13, 2006 5:51 pm
Posts: 1
I have a similar problem: we can't (for legacy reasons) use optimistic locking in our application, but setting optimistic locking to anything but "version" throws the exception nhiggs references. The code backs this up, though the documentation doesn't comment on it, and I've not been able to track down a reason for this behavior. Does anyone know why version-based optimistic locking is required for joined-subclass?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 14, 2006 12:35 pm 
Beginner
Beginner

Joined: Mon Sep 27, 2004 4:28 pm
Posts: 44
I'm confused as well. The source explicitly disallows any optomistic lock strategy other than "version". From JoinedSubclassEntityPersister's constructor:

Code:
if ( optimisticLockMode()!=Versioning.OPTIMISTIC_LOCK_VERSION ) {
   throw new MappingException(
   "optimistic-lock attribute not supported for joined-subclass mappings: " + getEntityName()
   );
}


I can't find any documentation in the manual, HiA, the wiki, or this forum actually stating that this is an as-designed rule... even though that condition seems to have been in the class for some time (source history wasn't preserved prior to a refactoring pre-hib3).

Can anyone confirm that this constraint is still needed and maybe share some insight as to why? Christian, it might be a useful note in the inheritance modeling chapter.. as this is a limitation that will certainly affect those decisions for some folks.

Thanks in advance!

Phill


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 26, 2007 6:55 am 
Beginner
Beginner

Joined: Wed Dec 13, 2006 10:39 am
Posts: 26
are there any news or outcomes about this problem?
i have the same problem because the reference did not mention any limitations to the optimistic-lock="dirty".


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 26, 2007 12:15 pm 
Beginner
Beginner

Joined: Mon Sep 27, 2004 4:28 pm
Posts: 44
Yup. Mr. Ebersole was kind enough to fix the issue I entered:

http://opensource.atlassian.com/project ... e/HHH-2242


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 29, 2007 4:54 am 
Beginner
Beginner

Joined: Wed Dec 13, 2006 10:39 am
Posts: 26
thx for the link.
so the optimistic locking mode "dirty" will not be supported for joined-subclasses in future?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 7 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.