Hi, I try to use the ODMG API of OJB.
I noticed that, if I read an object from the database, then modify a property that is declared as a primary key (in the mapping) and save the object to the database, a new row is created as if it was a new object inserted. Is there a way to modify an object's primary key without having to delete it from the database before ? follows a sample code. ----------------------------------- <class-descriptor class="year" table="numord" > <field-descriptor name="year" column="annee" primarykey="true" /> </class-descriptor> public class year { private int year; public int getYear() { return year; } public void setYear(int year) { this.year = year; } } public class test { public static void main(String[] args) { year y = new year(); try { Implementation impl = OdmgSingleton.odmg; //OdmgSingleton is a static class of mine. Transaction t = impl.newTransaction(); t.begin(); org.odmg.OQLQuery query = impl.newOQLQuery(); query.create("select p from year"); DList results = (DList)query.execute(); y = (year)results.iterator().next(); t.lock(y,Transaction.WRITE); y.setYear(2004); t.commit(); } catch (Exception e) { e.printStackTrace(); } } } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]