[hibernate-issues] [Hibernate-JIRA] Closed: (HHH-1495) Instance should not be created to determine unsaved-value for primitive @Id type
Steve Ebersole (JIRA)
noreply at atlassian.com
Mon Mar 21 13:00:38 EDT 2011
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1495?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Steve Ebersole closed HHH-1495.
-------------------------------
Closing stale resolved issues
> Instance should not be created to determine unsaved-value for primitive @Id type
> --------------------------------------------------------------------------------
>
> Key: HHH-1495
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1495
> Project: Hibernate Core
> Issue Type: Bug
> Components: core
> Affects Versions: 3.1.2
> Reporter: Barry Kaplan
>
> I am having problems with @Id and its unsaved-value. I would like the unsaved-value to default to something without an instance being created. But the code in UnsavedValueFactory.getUnsavedIdentifierValue seems to choose to try to instantiate an instance before it checks whether the @Id is of a primitive type:
> if ( unsavedValue == null ) {
> if ( identifierGetter!=null && constructor!=null ) {
> // use the id value of a newly instantiated instance as the unsaved-value
> Serializable defaultValue = (Serializable) identifierGetter.get( instantiate(constructor) );
> return new IdentifierValue( defaultValue );
> }
> else if ( identifierGetter != null && (identifierType instanceof PrimitiveType) ) {
> Serializable defaultValue = ( ( PrimitiveType ) identifierType ).getDefaultValue();
> return new IdentifierValue( defaultValue );
> }
> ...
> I don't really need the default constructor. If I get rid of it, I get past determining the unsaved-value, but then fail later on in PojoInstantiator.instantiate.
> (See also http://forum.hibernate.org/viewtopic.php?t=955569)
--
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