1 Reply Latest reply on Oct 4, 2001 5:12 PM by Case Roole

    CMP primary key problem with MySQL

    Case Roole Newbie

      When converting an application from PostgreSQL to MySQL I found that finders returning collections would still work, but findByPrimaryKey would not:
      javax.ejb.ObjectNotFoundException: Object with primary key 6706 not found in storage

      I would appreciate any reactions explaining what to think of when getting an error message like this. If google is any indication, (too) few people have had this problem.

      I am using primary key classes that are just wrappers around int's, with their hashCode returning the int and their toString returning ""+int. I wouldn't mind Integers for primary keys, but that didn't seem to work.

      As said, the code I use would work successfully with PostgreSQL. I would appreciate any ideas about why MySQL won't work for primary keys with CMP while PostgreSQL does when running the same programme code.

      I am using JBoss-2.4.2-Catalina-4.0, with a MySQL datasource.

        • 1. Re: CMP primary key problem with MySQL
          Case Roole Newbie

          Hm. I circumvented the problem by using java.lang.Integer as primary key class. Perhaps the setup that a public field in the primary key class that has the same name as the designated primary key according to ejb-jar.xml does not work for MySQL. Don't take this too seriously, I write this mostly to make clear that there is no desperate person at this end who is halted until helped :-)
          I really must learn more about EJB's...