Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[eclipselink-users] Table generated identifiers (JPA spec. question)

Sorry, it's me again.

I am laboring under what might be a misunderstanding of the JPA specification in this regard and wanted to check it out.

I have an entity with a table-generated identifier.

I was under the impression that JPA's intent was the following:

If I have set any value whatsoever in the @Id-annotated field, when I persist() my entity--whose identity is table-generated--then that value will get written over by the table generator.

So for example if I create a PersonEntity with an id of 5, and if that PersonEntity has been annotated such that his identity is supposed to come from a table generator (or any generator, frankly, but let's just stick to table generation), then after a persist() operation on that PersonEntity the JPA provider would replace the value of his id field with (say) 4200.

Instead what I am observing is that EclipseLink will simply attempt to take my value (5 in my example) and insert it.

I could not find a section in the JPA specification that indicates what the proper behavior is here.

Thanks,
Laird

--
http://about.me/lairdnelson


Back to the top