-->
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: Possible to turn on/off some annotation based on type of DB?
PostPosted: Sun May 04, 2008 11:16 pm 
Regular
Regular

Joined: Wed Apr 12, 2006 12:49 am
Posts: 105
Location: Malaysia
Hi,

Id @SequenceGenerator is not applicable MYSQL database but applicable to Oracle database.

Is it possible to make this annotation to only "turn on" if I'm running Oracle database and ignore if I'm running MYSQL database at runtime?

So that we can switch to different database easier without having to change the entity class annotations.

Please advise.

_________________
Thank you.

Regards,
Jap.


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 05, 2008 6:11 am 
Hibernate Team
Hibernate Team

Joined: Thu Apr 05, 2007 5:52 am
Posts: 1689
Location: Sweden
Hi,

If you want database independence I recommend using GenerationType.AUTO. This will choose the key generator transparently depending on the capabilities of the underlying db.

--Hardy


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 05, 2008 9:27 pm 
Regular
Regular

Joined: Wed Apr 12, 2006 12:49 am
Posts: 105
Location: Malaysia
Excellent, it works.

_________________
Thank you.

Regards,
Jap.


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.