-->
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.  [ 6 posts ] 
Author Message
 Post subject: Mapping for self-made IdentifierGenerator Implementation
PostPosted: Wed Jan 19, 2005 12:11 pm 
Newbie

Joined: Wed Feb 04, 2004 12:33 pm
Posts: 13
Location: Vienna/Austria
Hi all,

Hibernate version: 2.1.7
Name and version of the database you are using: Oracle 9iR2

I've the following question?

I'm able to write my own IdentifierGenerator.
Of course I can draw the next Id and set it before saving,
but I want Hibernate to do this automatically in the background.

any hints/ideas how to map the generator properly -
the assigned strategy is mentioned not to be choosen in the first
place in the Hibernate Bible (p. 91/92)!

Thx in advance!
Klaus from Vienna/Austria (no kangaroos)


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 19, 2005 12:36 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Well, just write your own Generator and tell hibernate to use it via generator="yourclassname"


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 19, 2005 12:44 pm 
Newbie

Joined: Wed Feb 04, 2004 12:33 pm
Posts: 13
Location: Vienna/Austria
First - thx for the early reply!

assuming my IdentifierGenerator has the fully qualified classname

com.domain.MyIdentifierGenerator

you would really write the following mapping:

<class name="..." table="...">
<id name="id" column="..." type="long">
<generator class="com.domain.MyIdentifierGenerator">
</id>

...
</class>

In my understanding class denotes the generator strategy
from a predefined set of values {native, identity, sequence, increment, .... }

could you please confirm this, because it's urgently needed!

Again thx for your support!

kind regards
K:)


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 19, 2005 12:53 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Yes, just how I said. Please, this is very clearly in the manual at http://www.hibernate.org/hib_docs/reference/en/html/mapping.html#mapping-declaration-id-generator


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 19, 2005 12:58 pm 
Newbie

Joined: Wed Feb 04, 2004 12:33 pm
Posts: 13
Location: Vienna/Austria
Thanks & sorry to bother U

I was studying Hibernate in Action ...
forgot about the online-manual!


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 21, 2005 10:35 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
CaveDiver wrote:
I was studying Hibernate in Action ...
forgot about the online-manual!

Both are very complementary.

_________________
Emmanuel


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