-->
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.  [ 4 posts ] 
Author Message
 Post subject: Optimistic lock ( version attribute ) w/reverse engineering
PostPosted: Sun Jul 30, 2006 4:14 pm 
Newbie

Joined: Mon Oct 17, 2005 11:56 am
Posts: 16
Location: Arlington, VA
Hi All,

I'm using:

Java 5
Eclipse 3.1.2
Hibernate Tools 3.2Beta5
Hibernate 3.0.5
JBoss 4.0.3SP1

and I've got reverse engineering working on a group of about thirty interrelated tables, generating both hbms and java files (with a lot of help from Max and other users of this forum!).

Overall, I've matched everything I used to do in Middlegen except one thing I just realized I really need, which is designating an attribute as the version attribute for automated optimistic locking enforcement by Hibernate.

I searched the forums for a mention of this, but didn't find anything in the context of hibernate tools reverse engineering. Is that implemented? Anyone else need that capability?

Thanks!
Vick


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jul 30, 2006 9:24 pm 
Newbie

Joined: Fri Jul 14, 2006 10:52 am
Posts: 16
You mean something like this:
<version name="LockSequence" column="CIT_LOCKSEQ" type="int"/>

I am not sure if this type is what hibernate recommends; it just is an int in my existing schema that I am converting to hib now.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 31, 2006 12:53 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
currently the tool automatically makes columns named VERSION or TIMESTAMP into either <version> or <timestamp>

it is not controllable via the reveng.xml yet, but is controllable via customizing your reverse engineering strategy.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject: Version column by name: it's automatic!
PostPosted: Mon Jul 31, 2006 8:39 am 
Newbie

Joined: Mon Oct 17, 2005 11:56 am
Posts: 16
Location: Arlington, VA
That's just what we need! Here's the automatically generated output in my hbm file for my version column:

<version name="version" type="long">
<column name="VERSION" scale="0" not-null="true" />
</version>

Thanks!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.