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?
|