[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-4324) Need a way to specify "unsaved-value" strategy using annotations

Gail Badner (JIRA) noreply at atlassian.com
Thu Mar 29 18:57:50 EDT 2012


    [ https://hibernate.onjira.com/browse/HHH-4324?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=46126#comment-46126 ] 

Gail Badner commented on HHH-4324:
----------------------------------

I believe this issue is out of date. Is anyone still having problems with this?

> Need a way to specify "unsaved-value" strategy using annotations
> ----------------------------------------------------------------
>
>                 Key: HHH-4324
>                 URL: https://hibernate.onjira.com/browse/HHH-4324
>             Project: Hibernate ORM
>          Issue Type: New Feature
>          Components: annotations
>         Environment: Hibernate 3.2.2, Hibernate-annotations 3.2.1
>            Reporter: Suji Suresh
>            Priority: Minor
>
> Hibernate has two ways of specifying a value for primary key:
> 1. Assign a value before handing it over to Hibernate
> 2. Have Hibernate generate the value before persisting
> In my project I have objects of both of the above specified types. In other words I assign value for the primary key for some the objects (lets call these objects "assigned") and for others I have Hibernate generate the value before persisting (lets call these objects "generated"). Since Hibernate annotations does not support "unsaved-value", I do not have a way of specifying "unsaved-value" strategy. While my "generated" objects work perfectly with Hibernate's default "unsaved-value" strategy, I see wrong (but expected) behaviour when I try to persist an "assigned" object that is already present in the database in that, I get StaleStateException instead of DataIntegrityViolationException

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list