-->
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.  [ 2 posts ] 
Author Message
 Post subject: Best strategy for managing PK generator centrally?
PostPosted: Wed May 11, 2005 4:34 pm 
Newbie

Joined: Thu Jan 20, 2005 11:01 am
Posts: 15
I was wondering if anyone had thoughts on what strategy I shold use to centrally manage the type of primary key generators I want assigned to all my classes.

I'm building a new schema in JDK 1.5 in Hibernate 3.0 + Annotations with about 200 tables. Today I am assuming that an integer-based primary key for all the tables would be good. Later, though, if I decide to switch to UUIDs/GUIDs then I would need to go through all the classes and manually change them. I would also like to be able to switch types on primary keys during design phase to test relative performance of different PK generator types.

Just like Hibernate supports a NamingStrategy interface that allows us to trap and generate the proper names we want in our database I was thinking that a TypingStrategy or something like that may be useful at the time the binding was done. This way, when binding a primary key (@Id) if we didn't supply a generator type we could centrally define a generator and the @Id annotation binder would pick it up.

Thoughts?


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 13, 2005 4:20 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
While not considered as a good design, you can use a superclass holding your id definition, and let every entity inherit this super class

_________________
Emmanuel


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