Hi Laird,

I haven't dug into the ReverseMappingTool although the output you have 
presented does not look good to me either.

Trying to enlighten the datastore identity thing, I consider it as a case when 
your Entity has no field for primary key. Instead, OpenJPA keeps it and manages 
under the hood. I would expect the tool to generate @DataStoreId on the entity 
class [1].

Greetings,
Milosz

[1] 
http://openjpa.apache.org/builds/latest/docs/manual/manual.html#ref_guide_pc_oid_datastore


> I am baffled at the output of the ReverseMappingTool in OpenJPA 1.2.2 when
> it comes to datastore identity.
> 
> Perhaps I am missing what datastore identity is.  I had assumed that a class
> conceptually has datastore identity when it has, for example, an
> auto-assigned primary key.  In such a case I'd expect the ReverseMapping
> tool to omit any setters for this field, and to disallow its presence in
> constructors.
> 
> I'd also expect the annotations produced to involve @GeneratedValue (or
> whatever it is; typing from memory).
> 
> Instead I see a syntactically invalid @PrimaryKeyJoinColumn annotation
> mushed into the @Table annotation, and basically nothing else (i.e. no other
> mention whatsoever of the primary key column in the mapping):
> 
> @Entity
> @Table(schema="foobar", name="bizbaw", @PrimaryKeyJoinColumn(name="pk",
> columnDefinition="serial"))
> public class Blah {
> 
> What on *earth* is happening here?  As far as I can tell, this comes about
> if I turn the useDatastoreIdentity property on in the reverse mapping tool.
> 
> I scanned the source base and then discovered that there's nothing in the
> annotation serializer that even attempts to use @GeneratedValue.  Am I on my
> own for this?
> 
> Thanks,
> Laird
> 

Reply via email to