persistence@glassfish.java.net

Retrive autoincrement value with MySQL connector 5.1

From: kai pupha <kai_kree_at_hotmail.co.uk>
Date: Tue, 24 Jul 2007 08:01:52 +0100

Hi there,

I am new and trying Java Persistence using J2SE and found one problem that
you may be able to help. I have 2 tables let say: 1) tbCUSTOMER: ID(PK) and
Name; and 2) tbORDER: ID(PK), Address and Customer_ID(FK).
tbORDER.Customer_ID is a forign key of tbCustomer.ID.

When i want to update the foriegn key (tbORDER.Customer_ID) obtained from
newly generated value from tbCustomer.ID it just updates NULL value but the
rest of the fields are updated successfully.

I am using JDK 6, Netbeans M10 with Toplink and MySQL Connector 5.1. Do you
know that autoincrement is supported in JPA or how can i work around to
obtain a newly generated primary key please?

Thank you,
Kreecha

_________________________________________________________________
Watch all 9 Live Earth concerts live on MSN. http://liveearth.uk.msn.com