hi, i found a problem with using a compound primary key (two columns). it appears only if one of the keys is set to "" (an empty string, NOT!!!! null).
here's my setup: ojb 1.0.1, mysql 4.0.23 on XP prof., jdk 1.4.2_07 repository.xml: <class-descriptor class="com.creative_it.webcreator.resources.Property" table="properties"> <field-descriptor id="1" name="key" column="id" jdbc-type="VARCHAR" primarykey="true" indexed="true"/> <field-descriptor id="2" name="locale" column="locale" jdbc-type="VARCHAR" primarykey="true" indexed="true"/> <field-descriptor id="3" name="value" column="value" jdbc-type="VARCHAR" /> </class-descriptor> the database layout: +--------+--------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +--------+--------------+------+-----+---------+-------+ | id | varchar(255) | | PRI | | | | value | text | YES | | | | | locale | varchar(255) | | PRI | | | +--------+--------------+------+-----+---------+-------+ example code: Property prop = new Property(); prop.setKey("whateverKey"); prop.setLocale(""); prop.setValue("some test value"); broker.beginTransaction(); // this one works if table doesn't have one element with same key and locale broker.store(prop); broker.commitTransaction(); prop.setValue("a new value"); broker.beginTransaction(); // this one fails with the following exception broker.store(prop); broker.commitTransaction(); the exception raised is: org.apache.ojb.broker.KeyConstraintViolatedException: SQL failure while insert object data for class com.creative_it.webcreator.resources.Property, PK of the given object is [ key=test.property locale=], object was [EMAIL PROTECTED], exception message is [Duplicate key or integrity constraint violation message from server: "Duplicate entry 'test.property-' for key 1"] at org.apache.ojb.broker.accesslayer.JdbcAccessImpl.executeInsert(JdbcAccessImp l.java:239) at org.apache.ojb.broker.core.PersistenceBrokerImpl.storeToDb(PersistenceBroker Impl.java:1642) at org.apache.ojb.broker.core.PersistenceBrokerImpl.store(PersistenceBrokerImpl .java:1557) at org.apache.ojb.broker.core.PersistenceBrokerImpl.store(PersistenceBrokerImpl .java:715) at org.apache.ojb.broker.core.DelegatingPersistenceBroker.store(DelegatingPersi stenceBroker.java:175) at org.apache.ojb.broker.core.DelegatingPersistenceBroker.store(DelegatingPersi stenceBroker.java:175) at com.creative_it.webcreator.junit.resources.PropertyTest.testProperty(Propert yTest.java:63) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39 ) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl .java:25) at java.lang.reflect.Method.invoke(Method.java:324) at junit.framework.TestCase.runTest(TestCase.java:154) at junit.framework.TestCase.runBare(TestCase.java:127) at junit.framework.TestResult$1.protect(TestResult.java:106) at junit.framework.TestResult.runProtected(TestResult.java:124) at junit.framework.TestResult.run(TestResult.java:109) at junit.framework.TestCase.run(TestCase.java:118) at junit.framework.TestSuite.runTest(TestSuite.java:208) at junit.framework.TestSuite.run(TestSuite.java:203) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRu nner.java:421) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner. java:305) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner .java:186) if i update the database entry with native SQL (e.g. UPDATE properties SET value="another value" WHERE id="whateverKey" AND locale="") everything works fine, so i'm pretty sure it is not a database problem or database error. also everything works fine if "locale" is set to e.g. "de_AT" or anything else except an empty string. maybe the broker does something unexpected with the empty "" string? any ideas? kr, guenther