-->
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.  [ 1 post ] 
Author Message
 Post subject: Using Generatornames multiple times (Generatedvalue)
PostPosted: Fri Mar 08, 2013 9:25 am 
Newbie

Joined: Fri Mar 08, 2013 9:08 am
Posts: 1
Hi,

we are currently migrating from MSSQL to Oracle and we dont want to use the hibernate_sequence for all tables. Each table should have its own Sequence.

We already did the change but I'd like to get some info if our solution is safe to use..

Most of our classes are extending from baseentities but we also have a couple of stand-alone entities.
What we changed:

-baseentities(@MappedSuperclass):
changed: @GeneratedValue(strategy = GenerationType.AUTO)
to: @GeneratedValue(strategy = GenerationType.AUTO, generator = "HIBERNATE_GENERATOR")

-extending entities:
added after the @Table annotation: @SequenceGenerator(name = "HIBERNATE_GENERATOR", sequenceName = "${TABLENAME}_SEQ")

-stand-alone entities:
added after the @Table annotation: @SequenceGenerator(name = "HIBERNATE_GENERATOR", sequenceName = "${TABLENAME}_SEQ")
changed : @GeneratedValue(strategy = GenerationType.AUTO)
to: @GeneratedValue(strategy = GenerationType.AUTO, generator = "HIBERNATE_GENERATOR")

So we are using always the same generatorname "HIBERNATE_GENERATOR", only the sequenceNames are different.
Our applications seems to work fine, but is it safe to use always the same generatorname?

regards


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

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.