Hi Guys,
I'm trying to get a handle on the java persistence api using hibernate3.2 (cr2 with hibernate annotations 3.2 cr1 and hibernate entitymanager 3.2 cr1). My first examples with @Id @GeneratedValue. These worked great. Now I have a simple 1 column table annotated as @Id but the user must enter the value of the column (i.e. not @GeneratedValue)
Now all I can get is Unsaved-value strategy UNDEFINED in the middle of the stack trace.
The only doco that I can find is as below. My interpretation of is is that I don't need a mapping file and it is no longer necessary to define an unsaved-value strategy. Is there a workaround? An hibernate annotation that I can use, perchance??
Many thanks
Mark
*************Hibernate Documentation*******************
Identifier mappings
The unsaved-value attribute is now optional, in most cases. Hibernate will use unsaved-value="0" as the default, where that is sensible.
Note: In Hibernate3, it is no longer necessary to implement Interceptor.isUnsaved() when using natural keys (assigned identifiers or composite identifiers) and detached objects. In the absence of any "hints", Hibernate will query the database to determine if an object is new or detached. However, the use of Interceptor.isUnsaved() might result in higher performance, since the database query can be avoided.
|