users@glassfish.java.net

Problems with Persistence

From: <glassfish_at_javadesktop.org>
Date: Wed, 04 Apr 2007 00:40:19 PDT

Dear all,

I have the following problem. I have developed a simple application (Sun AS 9 Upd2 + Netbeans 5.5 + Derby database included in the AS) with a simple entity class representing an information on the database and a session facade bean for the entity class. I also developed (in the same project, same EAR) a web interface with JSF that allow me to create a new entity and list all the entity. Supposing to set the table generation strategy to "drop-and-create" in the persistence.xml file all is working because I can create new entities and if I re-deploy the EAR the table is deleted and created. If I set the table generation strategy to "create" the application work only the first time when the table is empty. I can create new entities. If I re-deploy the EAR the table is not deleted but when I try to create new entities I have an error regarding the Primary Key. The application is not able to update the new PK (in my entity I set the auto generation for PK). I hope I was clear in my explanation. Is there someone able to explain me this error and if I can correct it?

Thanks in advance and regards,
Giordano
[Message sent by forum member 'giordano48' (giordano48)]

http://forums.java.net/jive/thread.jspa?messageID=211199