1 Reply Latest reply on May 14, 2003 10:40 AM by Bob Allison

    more composite pk troubles

    philross Newbie

      So i got around the broken(?) PK constraint generation for composite primary keys by disablking primary key creation in the jbosscmp-jdbc.xml deployment descriptor. Unfortunately this isnt the end of troubles... something more serious is happening now. During creation of an actual entity, I get JDBC errors showing that the SQL statement that it's trying to use to look for duplicate entity is just a blank WHERE clause??!?

        • 1. Re: more composite pk troubles
          Bob Allison Newbie

          I was having problems just like yours.

          I started browsing through the JBoss code to determine how that SQL was being generated (isn't open source WONDERFUL?). The symptom is caused by JBoss believing that the table has no primary key fields.

          Well, I double-checked my code and determined that I had XDoclet "ejb.pk-field" tags on both of my key fields. When I look a little farther, though, I also noticed that I had accidentally left a "ejb.pk" tag which set the class of the PK to Integer in the code. Taking the latter tag out of the source cured the problem.

          Digging a little deeper, here is what the inclusion of that tag did to the XML: It changed the value of the <prim-key-class> attribute of the bean definition in the deployment descriptor.