Hi
I'm writing my first application using the javax.persistence framework with
openJPA as it's implementation over a MySQL database (5.1.34) I've managed to
get everything setup and I'm able to persist my entities to the database
successfully.
I'm using the
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
to generate the primary keys for most of the database tables and this is where
I'm running into problems. I need to know the value of the generated keys of
some of the entities so I can maintain foreign key relationships. I've found
the bit in the manual that tells me to use OpenJPAEntityManager.getObject()
method and this works, but it means that I have to cast my
javax.persistence.EntityManager to an OpenJPAEntityManager which means that
my application classes are tied to the OpenJPA implementation. What am I
missing?
Regards