]
Steve Ebersole closed HHH-1014.
-------------------------------
Closing stale resolved issues
id should still be null after unsuccessful saving of a new object -
but isn't
-----------------------------------------------------------------------------
Key: HHH-1014
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-1014
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.0.5
Environment: postgresql, hibernate wired up via spring, also reproducible with
3.1 beta 3
Reporter: Thomas Jachmann
Assignee: Steve Ebersole
I have quite a simple object: Utility. It's property name has to be unique:
<class name="Utility">
<id name="id">
<generator class="sequence"/>
</id>
<version name="version"/>
<property name="name" unique="true"
not-null="true"/>
<many-to-one name="postalAddress" column="postal_address_id"
lazy="false" cascade="all" not-null="true"/>
<many-to-one name="client" class="Client"
column="client_id" lazy="false" cascade="all"/>
<property name="phone"/>
<property name="fax"/>
</class>
I think that the other properties/relationships don't matter.
When I save a new Utility that's name already is in the database, I get a
ConstraintViolationException. This is expected behaviour. But afterwards, the id of the
utility is set. So are those of all related objects (postalAddress and client). As far as
I understand it, they should be null indicating that the objects are still not persistet.
When I change the name and try to save it again, I get a StaleObjectStateException. This
seems to be a bug, since actually, the object isn't in the database because of the
constraint violation.
Regards,
Thomas
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: