[hibernate-issues] [Hibernate-JIRA] Created: (HBX-1034) Need a way to have a "native-if-not-assigned" IdentifierGenerator
Paul Shemansky (JIRA)
noreply at atlassian.com
Fri Jan 11 16:41:55 EST 2008
Need a way to have a "native-if-not-assigned" IdentifierGenerator
-----------------------------------------------------------------
Key: HBX-1034
URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-1034
Project: Hibernate Tools
Issue Type: New Feature
Reporter: Paul Shemansky
Attachments: hibernate-native-or-assigned-patch.diff
NOTE: I believe I have explored every documented possibility in achieving the desired functionality. If I have misused Hibernate, the forum, or Google, I humbly apologize and stand to be corrected.
With that being said, I believe this may be desired:
--------------------------------------------------------------------
By setting the Hibernate configuration's primary key column to use a "native" implementation, Hibernate ALWAYS generates the entity's id when a save() is being called. There is no way to "override" the generated id.
The attached patch creates an IdentityGenerator which allows a programmer to override the "generated" id, with an "assigned" id at runtime simply by setting the primary key property.
The patch also changes the IdentifierGeneratorFactory to allow the short-name selection of the generator via a configuration file.
Furthermore, the English documentation is patched to describe the generator, accordingly.
Possibly related issues and reference material:
The documentation does not seem to provide a solution for a native-if-not-assigned generator; you seem to only have one, or the other:
http://www.hibernate.org/hib_docs/reference/en/html/mapping.html#mapping-declaration-id-generator
A scenario which describes a typical use case that warrants the proposed new feature:
http://forum.hibernate.org/viewtopic.php?t=982560&highlight=native+id+generator
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the hibernate-issues
mailing list