]
Max Rydahl Andersen closed HBX-1034.
------------------------------------
Resolution: Rejected
Two things:
1) This is not for Hibernate Tools but Hibernate Core
2) This is exactly what custom id generators are for; putting it in as a default provided
id generator would be bad since you cannot gurantee id overlap
3) have you looked at session.replicate() ?
4) you could put this on the wiki to share it with others.
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
Original Estimate: 10 minutes
Remaining Estimate: 10 minutes
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-...
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...
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: