Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[eclipselink-users] history table cannot use automatic increment column as primary

Hi everyone,

 

The problem is when I use an automatic increment id, the java object will get the wrong id, could anyone know how to solve it.

 

For example:

                Consignee consignee= new Consignee();

                // … add some data

                entityManager.persist(consignee);

 

after persist, the consignee.getId() is not the same as in database, you can make a test. It’s easy.

 

Plus, if I use a datetime column as primary column, the above problem solved,  but the duplicated key exception keeps popup, if  the insert and update at same time.

 

Regards,

Joe

 


Back to the top