2 Replies Latest reply on Sep 17, 2002 4:36 PM by Ryan Delano

    problem with entity bean

    kirk Newbie


      I have already depoyed ejb to jboss,when I run entity bean client which creat a row to the database, the console shows everything is ok, but when I connect to database, execute select sql statement,but what a surprise! the data does not insert to database,Why??? furthermore,when I run the client with the same data again, the console shows that "javax.ejb.DuplicateKeyException: Entity with key XXX already exists",what's the reason,anybody can tell me? thanks.

        • 1. Re: problem with entity bean
          Michael Beauford Newbie

          This is my wild guess, but I think the Container is keeping track of the Primary Key field. It may have not added the data in your DB table, but JBoss thinks it did and keeps tracks of the primary key sequence. Restart the JBoss server and see if you can re-add the data.

          • 2. Re: problem with entity bean
            Ryan Delano Newbie

            I know this is an old topic, but just incase someone hits it while searching like I did:

            This pattern can happen if your deployer (or you) forget to specify the datasource and datasource-mapping in the appropriate file. As most people know JBuilder doesn't have native support for JBoss, though it should - I thought it would specify the datasource in ejb-jars.xml. As it turned out I had to add it (by way of a JBuilder addin or manually) to jbosscmp-jdbc.xml like this:






            Prior to adding these two settings I was hitting the default datasource. Didn't take long to catch, but it could at 3 am...

            Maybe that will help someone else down the road?