Sun Java System Application Server 9.1 Troubleshooting Guide

Application Generates Error


A is generated by an application, with a nested java.sql.SQLException indicating a duplicate primary key.

Even if the application is checking for a CreateException, it does not see one. The Enterprise JavaBeans specification requires a CreateException to be thrown only if two beans with the same primary key are created in the same transaction, so a CreateException is not thrown on transaction rollback if two entity beans with duplicate primary keys are created.


If an application creates an entity bean with a duplicate primary key, check to see if the primary key exists by calling findByPrimaryKey before calling create.