[hibernate-dev] Shortcomings in org.hibernate.id.enhanced.TableGenerator class

Tom Muldoon tom at firstbest.com
Thu Apr 24 08:03:48 EDT 2008


I'm working with the org.hibernate.id.enhanced.TableGenerator class and I've noticed a couple of shortcomings (imho). First and foremost, it creates one row in the hibernate_sequences table for each configured segment_value (as opposed to one row for each "target_table" as implemented within the MultipleHiLoPerTableGenerator). Given the fact that my id column is defined in an abstract BaseEntity class, I can't use the enhanced TableGenerator class as is (since one sequence for all of my entities is not viable for my application). Which leads me to my second point. All of the member variables are declared as private, instead of protected, which makes extending the class for the purpose of overriding the configure method impossible.

For what it's worth, here's the change that I had planned to make (in the configure method) ...

Change the setting of the segmentValue from ...

        segmentValue = params.getProperty( SEGMENT_VALUE_PARAM );
... to

        segmentValue = params.getProperty(TABLE);

Of course, such a change would change the class behavior significantly - using targetTable instead of segmentValue as the variable name would probably make sense.

So, with that said, is another class worth-while (assuming that such a change to the existing class would break backwards compatability)?

And, on a related note, the enhanced TableGenerator is cluster safe, right?

Thoughts?

PS. I entered a jira improvement yesterday - here's the link ...

http://opensource.atlassian.com/projects/hibernate/browse/HHH-3249
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/hibernate-dev/attachments/20080424/0321c5cb/attachment.html 


More information about the hibernate-dev mailing list