-->
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.  [ 3 posts ] 
Author Message
 Post subject: Generating ID with GUIDGenerator with Hibernate Annotation
PostPosted: Wed Dec 26, 2007 9:38 pm 
Newbie

Joined: Fri Dec 22, 2006 4:47 am
Posts: 6
Dear all,

I wanted to generate my primary key with GUIDGenerator, but my metadata uses Hibernate Annotation instead of XML. How do I do this? I couldn't figure it out and find related documentation regarding this.

Thanks in advance


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 02, 2008 11:22 am 
Pro
Pro

Joined: Tue Jun 12, 2007 4:13 am
Posts: 209
Location: Berlin, Germany
The Hibernate book gives an answer, i.e.:

@org.hibernate.annotations.GenericGenerator(
name="hibernate-uuid"
strategy="uuid"
)

Have a look into the docs or the source code of annotations and I think you find what you exactly need.

Carlo


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 03, 2008 12:56 pm 
Expert
Expert

Joined: Sat Jan 17, 2004 2:57 pm
Posts: 329
Location: In the basement in my underwear
This is an example from one of our entities.

@Id
@GenericGenerator(name = "generator", strategy = "uuid")
@GeneratedValue(generator = "generator")
@Column(name = "AGMT_CNTRCT_LINE_V_ID", unique = true, nullable = false, insertable = true, updatable = false)

_________________
Some people are like Slinkies - not really good for anything, but you still can't help but smile when you see one tumble down the stairs.


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