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

Christian Bauer (JIRA) noreply at atlassian.com
Fri May 4 13:52:04 EDT 2007


    [ http://opensource.atlassian.com/projects/hibernate/browse/ANN-609?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_26853 ] 

Christian Bauer commented on ANN-609:
-------------------------------------

And, by the way, marking it as "bug" or "feature" does not really influence when or if someone on our side will write the code for you. Your best bet is to implement the annotation yourself and to submit a patch. 

> Need a way to specify "unsaved-value" strategy using annotations
> ----------------------------------------------------------------
>
>                 Key: ANN-609
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-609
>             Project: Hibernate Annotations
>          Issue Type: New Feature
>         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.
-
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