I am having trouble getting a simple ManyToMany example working with version 2.7.3: http://pastie.org/1848262
I get an error on the second save (line 121) and the mysql log indicates that an attempt was made to insert the ListData bean again:
Apr 29, 2011 11:55:22 AM com.avaje.ebeaninternal.server.transaction.log.FileTransactionLoggerWrapper initialiseLogger
INFO: Transaction logs in: logs
Exception in thread "main" javax.persistence.PersistenceException: ERROR executing DML bindLog[Binding Insert [list_data] set[listId=1, name=test, ]] error[Duplicate entry '1' for key 1]
at com.avaje.ebeaninternal.server.persist.dml.DmlBeanPersister.execute(DmlBeanPersister.java:116)
at com.avaje.ebeaninternal.server.persist.dml.DmlBeanPersister.insert(DmlBeanPersister.java:76)
at com.avaje.ebeaninternal.server.persist.DefaultPersistExecute.executeInsertBean(DefaultPersistExecute.java:91)
at com.avaje.ebeaninternal.server.core.PersistRequestBean.executeNow(PersistRequestBean.java:527)
at com.avaje.ebeaninternal.server.core.PersistRequestBean.executeOrQueue(PersistRequestBean.java:557)
at com.avaje.ebeaninternal.server.persist.DefaultPersister.insert(DefaultPersister.java:404)
at com.avaje.ebeaninternal.server.persist.DefaultPersister.saveVanillaInsert(DefaultPersister.java:377)
at com.avaje.ebeaninternal.server.persist.DefaultPersister.saveVanillaRecurse(DefaultPersister.java:361)
at com.avaje.ebeaninternal.server.persist.DefaultPersister.saveRecurse(DefaultPersister.java:308)
at com.avaje.ebeaninternal.server.persist.DefaultPersister.save(DefaultPersister.java:282)
at com.avaje.ebeaninternal.server.core.DefaultServer.save(DefaultServer.java:1577)
at com.avaje.ebeaninternal.server.core.DefaultServer.save(DefaultServer.java:1567)
at com.avaje.ebean.Ebean.save(Ebean.java:538)
at test.CheckListOrder.main(CheckListOrder.java:27)
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry '1' for key 1
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:407)
at com.mysql.jdbc.Util.getInstance(Util.java:382)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1039)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3593)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3525)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1986)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2140)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2626)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2111)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2407)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2325)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2310)
at com.avaje.ebeaninternal.server.lib.sql.ExtendedPreparedStatement.executeUpdate(ExtendedPreparedStatement.java:164)
at com.avaje.ebeaninternal.server.type.DataBind.executeUpdate(DataBind.java:74)
at com.avaje.ebeaninternal.server.persist.dml.InsertHandler.execute(InsertHandler.java:155)
at com.avaje.ebeaninternal.server.persist.dml.DmlBeanPersister.execute(DmlBeanPersister.java:105)
... 13 more