It took me a couple days to track this down. But it looks like whenever you load up an object related to another object in a many to many relationship, and remove the first object or any not last object in that many to many list, then add a new object to the list, you get a duplicate key exception. This is the pertinent info from the little test project I wrote to illustrate this behavior. I can send the complete project if upon request.
Hibernate version: 2.1.4
Mapping documents:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping>
<class
name="Foo"
table="foo"
dynamic-update="false"
dynamic-insert="false"
>
<id
name="fooId"
column="foo_id"
type="long"
unsaved-value="0"
>
<generator class="native">
</generator>
</id>
<property
name="someValue"
type="java.lang.String"
update="true"
insert="true"
access="property"
column="some_value"
/>
<list
name="manyToManyList"
table="foo_bar"
lazy="true"
inverse="false"
cascade="all"
>
<key
column="foo_id"
>
</key>
<index
column="index_num"
/>
<many-to-many
class="Bar"
column="bar_id"
outer-join="auto"
/>
</list>
</class>
</hibernate-mapping>
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping>
<class
name="Bar"
table="bar"
dynamic-update="false"
dynamic-insert="false"
>
<id
name="barId"
column="bar_id"
type="long"
unsaved-value="0"
>
<generator class="native">
</generator>
</id>
<property
name="barName"
type="java.lang.String"
update="true"
insert="true"
access="property"
column="bar_name"
/>
</class>
<query name="Bar.by.name"><![CDATA[
from Bar bar where bar.barName = :name
]]></query>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():
try {
ses = sf.openSession();
tx = ses.beginTransaction();
Foo foo = (Foo) ses.load(Foo.class, fooId);
//Assuming that foo has a list of at least two bar's.
Bar bar = (Bar) foo.getManyToManyList().get(0);
Bar bar2 = new Bar();
bar2.setBarName("bar3");
foo.removeManyToManyList(bar);
foo.addManyToManyList(bar2);
log.debug("Removed and added bar objects.");
ses.update(foo);
tx.commit();
}
catch (Exception e) {
try {
if (tx != null && !tx.wasRolledBack()) {
tx.rollback();
ses.close();
}
}
catch (Throwable e1) {
log.error("Error rolling back TX.", e1);
}
log.error("Error changing bar objects.", e);
}
finally {
try {
ses.close();
}
catch (Throwable e1) {
log.error("Error closing session", e1);
}
}
Full stack trace of any exception that occurs:
[java] java.sql.BatchUpdateException: null, message from server: "Duplicate entry '1-2' for key 1"
[java] at com.mysql.jdbc.PreparedStatement.executeBatch(PreparedStatement.java:1404)
[java] at net.sf.hibernate.impl.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:54)
[java] at net.sf.hibernate.impl.BatcherImpl.executeBatch(BatcherImpl.java:122)
[java] at net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2417)
[java] at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2370)
[java] at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2236)
[java] at net.sf.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:61)
[java] at Main.main(Unknown Source)
Name and version of the database you are using:
MySQL 4.1.4-Gamma
Debug level Hibernate log excerpt:
[java] 17:41:09,205 DEBUG [Main] Building SessionFactory.
[java] 17:41:09,255 INFO [Environment] Hibernate 2.1.4
[java] 17:41:09,265 INFO [Environment] hibernate.properties not found
[java] 17:41:09,265 INFO [Environment] using CGLIB reflection optimizer
[java] 17:41:09,275 INFO [Configuration] configuring from resource: /hibernate.cfg.xml
[java] 17:41:09,275 INFO [Configuration] Configuration resource: /hibernate.cfg.xml
[java] 17:41:09,366 DEBUG [DTDEntityResolver] trying to locate
http://hibernate.sourceforge.net/hibern ... on-2.0.dtd in classpath under net/sf/hibernate/
[java] 17:41:09,366 DEBUG [DTDEntityResolver] found
http://hibernate.sourceforge.net/hibern ... on-2.0.dtd in classpath
[java] 17:41:09,406 DEBUG [Configuration] dialect=net.sf.hibernate.dialect.MySQLDialect
[java] 17:41:09,406 DEBUG [Configuration] show_sql=false
[java] 17:41:09,406 DEBUG [Configuration] connection.username=hibtest
[java] 17:41:09,406 DEBUG [Configuration] connection.password=hibtest
[java] 17:41:09,406 DEBUG [Configuration] connection.driver_class=com.mysql.jdbc.Driver
[java] 17:41:09,406 DEBUG [Configuration] connection.url=jdbc:mysql://localhost/hibtest
[java] 17:41:09,406 DEBUG [Configuration] use_outer_join=true
[java] 17:41:09,406 DEBUG [Configuration] show_sql=true
[java] 17:41:09,406 DEBUG [Configuration] transaction.factory_class=net.sf.hibernate.transaction.JDBCTransactionFactory
[java] 17:41:09,406 DEBUG [Configuration] jdbc.batch_size=5
[java] 17:41:09,416 DEBUG [Configuration] null<-org.dom4j.tree.DefaultAttribute@b32ed4 [Attribute: name resource value "Foo.hbm.xml"]
[java] 17:41:09,416 INFO [Configuration] Mapping resource: Foo.hbm.xml
[java] 17:41:09,426 DEBUG [DTDEntityResolver] trying to locate
http://hibernate.sourceforge.net/hibern ... ng-2.0.dtd in classpath under net/sf/hibernate/
[java] 17:41:09,426 DEBUG [DTDEntityResolver] found
http://hibernate.sourceforge.net/hibern ... ng-2.0.dtd in classpath
[java] 17:41:09,556 INFO [Binder] Mapping class: Foo -> foo
[java] 17:41:09,726 DEBUG [Binder] Mapped property: fooId -> foo_id, type: long
[java] 17:41:09,736 DEBUG [Binder] Mapped property: someValue -> some_value, type: string
[java] 17:41:09,746 INFO [Binder] Mapping collection: Foo.manyToManyList -> foo_bar
[java] 17:41:09,756 DEBUG [Binder] Mapped property: manyToManyList, type: java.util.List
[java] 17:41:09,756 DEBUG [Configuration] null<-org.dom4j.tree.DefaultAttribute@a7dd39 [Attribute: name resource value "Bar.hbm.xml"]
[java] 17:41:09,756 INFO [Configuration] Mapping resource: Bar.hbm.xml
[java] 17:41:09,766 DEBUG [DTDEntityResolver] trying to locate
http://hibernate.sourceforge.net/hibern ... ng-2.0.dtd in classpath under net/sf/hibernate/
[java] 17:41:09,766 DEBUG [DTDEntityResolver] found
http://hibernate.sourceforge.net/hibern ... ng-2.0.dtd in classpath
[java] 17:41:09,816 INFO [Binder] Mapping class: Bar -> bar
[java] 17:41:09,816 DEBUG [Binder] Mapped property: barId -> bar_id, type: long
[java] 17:41:09,816 DEBUG [Binder] Mapped property: barName -> bar_name, type: string
[java] 17:41:09,816 DEBUG [Binder] Named query: Bar.by.name ->
[java] from Bar bar where bar.barName = :name
[java] 17:41:09,816 INFO [Configuration] Configured SessionFactory: null
[java] 17:41:09,816 DEBUG [Configuration] properties: {hibernate.connection.password=hibtest, java.runtime.name=Java(TM) 2 Runtime Environment, Standard Edition, transaction.factory_class=net.sf.hibernate.transaction.JDBCTransactionFactory, sun.boot.library.path=C:\Java\j2sdk1.4.1_05\jre\bin, java.vm.version=1.4.1_05-b01, hibernate.connection.username=hibtest, ant.library.dir=c:\Java\eclipse\plugins\org.apache.ant_1.6.1\lib, java.vm.vendor=Sun Microsystems Inc., java.vendor.url=http://java.sun.com/, path.separator=;, java.vm.name=Java HotSpot(TM) Client VM, file.encoding.pkg=sun.io, use_outer_join=true, user.country=US, sun.os.patch.level=Service Pack 2, java.vm.specification.name=Java Virtual Machine Specification, user.dir=C:\Java\eclipse\workspace\ManyToManyTest, java.runtime.version=1.4.1_05-b01, java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment, java.endorsed.dirs=C:\Java\j2sdk1.4.1_05\jre\lib\endorsed, os.arch=x86, java.io.tmpdir=C:\DOCUME~1\resnik\LOCALS~1\Temp\, line.separator=
[java] , java.vm.specification.vendor=Sun Microsystems Inc., user.variant=, os.name=Windows XP, ant.home=c:\Java\eclipse\plugins\org.apache.ant_1.6.1, sun.java2d.fontpath=, java.library.path=C:\Java\j2sdk1.4.1_05\bin;.;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\ATI Technologies\ATI Control Panel;C:\Program Files\SecureCRT\;C:\Program Files\Executive Software\Diskeeper\, java.specification.name=Java Platform API Specification, java.class.version=48.0, hibernate.transaction.factory_class=net.sf.hibernate.transaction.JDBCTransactionFactory, java.util.prefs.PreferencesFactory=java.util.prefs.WindowsPreferencesFactory, os.version=5.1, connection.password=hibtest, user.home=C:\Documents and Settings\resnik, user.timezone=America/Chicago, connection.username=hibtest, java.awt.printerjob=sun.awt.windows.WPrinterJob, file.encoding=Cp1252, java.specification.version=1.4, hibernate.connection.driver_class=com.mysql.jdbc.Driver, show_sql=true, user.name=resnik, java.class.path=C:\Java\eclipse\plugins\org.apache.ant_1.6.1\lib\ant.jar;C:\Java\eclipse\plugins\org.apache.ant_1.6.1\lib\ant-antlr.jar;C:\Java\eclipse\plugins\org.apache.ant_1.6.1\lib\ant-apache-bsf.jar;C:\Java\eclipse\plugins\org.apache.ant_1.6.1\lib\ant-apache-resolver.jar;C:\Java\eclipse\plugins\org.apache.ant_1.6.1\lib\ant-commons-logging.jar;C:\Java\eclipse\plugins\org.apache.ant_1.6.1\lib\ant-commons-net.jar;C:\Java\eclipse\plugins\org.apache.ant_1.6.1\lib\ant-icontract.jar;C:\Java\eclipse\plugins\org.apache.ant_1.6.1\lib\ant-jai.jar;C:\Java\eclipse\plugins\org.apache.ant_1.6.1\lib\ant-jakarta-bcel.jar;C:\Java\eclipse\plugins\org.apache.ant_1.6.1\lib\ant-jakarta-log4j.jar;C:\Java\eclipse\plugins\org.apache.ant_1.6.1\lib\ant-jakarta-oro.jar;C:\Java\eclipse\plugins\org.apache.ant_1.6.1\lib\ant-jakarta-regexp.jar;C:\Java\eclipse\plugins\org.apache.ant_1.6.1\lib\ant-javamail.jar;C:\Java\eclipse\plugins\org.apache.ant_1.6.1\lib\ant-jdepend.jar;C:\Java\eclipse\plugins\org.apache.ant_1.6.1\lib\ant-jmf.jar;C:\Java\eclipse\plugins\org.apache.ant_1.6.1\lib\ant-jsch.jar;C:\Java\eclipse\plugins\org.apache.ant_1.6.1\lib\ant-junit.jar;C:\Java\eclipse\plugins\org.apache.ant_1.6.1\lib\ant-launcher.jar;C:\Java\eclipse\plugins\org.apache.ant_1.6.1\lib\ant-netrexx.jar;C:\Java\eclipse\plugins\org.apache.ant_1.6.1\lib\ant-nodeps.jar;C:\Java\eclipse\plugins\org.apache.ant_1.6.1\lib\ant-starteam.jar;C:\Java\eclipse\plugins\org.apache.ant_1.6.1\lib\ant-stylebook.jar;C:\Java\eclipse\plugins\org.apache.ant_1.6.1\lib\ant-swing.jar;C:\Java\eclipse\plugins\org.apache.ant_1.6.1\lib\ant-trax.jar;C:\Java\eclipse\plugins\org.apache.ant_1.6.1\lib\ant-vaj.jar;C:\Java\eclipse\plugins\org.apache.ant_1.6.1\lib\ant-weblogic.jar;C:\Java\eclipse\plugins\org.apache.ant_1.6.1\lib\ant-xalan1.jar;C:\Java\eclipse\plugins\org.apache.ant_1.6.1\lib\ant-xalan2.jar;C:\Java\eclipse\plugins\org.apache.ant_1.6.1\lib\ant-xslp.jar;C:\Java\eclipse\plugins\org.eclipse.ant.ui_3.0.0\lib\remoteAnt.jar;C:\Java\j2sdk1.4.1_05\lib\tools.jar, hibernate.show_sql=true, java.vm.specification.version=1.0, sun.arch.data.model=32, java.home=C:\Java\j2sdk1.4.1_05\jre, jdbc.batch_size=5, hibernate.connection.url=jdbc:mysql://localhost/hibtest, hibernate.dialect=net.sf.hibernate.dialect.MySQLDialect, java.specification.vendor=Sun Microsystems Inc., user.language=en, awt.toolkit=sun.awt.windows.WToolkit, hibernate.cglib.use_reflection_optimizer=true, java.vm.info=mixed mode, java.version=1.4.1_05, java.ext.dirs=C:\Java\j2sdk1.4.1_05\jre\lib\ext, sun.boot.class.path=C:\Java\j2sdk1.4.1_05\jre\lib\rt.jar;C:\Java\j2sdk1.4.1_05\jre\lib\i18n.jar;C:\Java\j2sdk1.4.1_05\jre\lib\sunrsasign.jar;C:\Java\j2sdk1.4.1_05\jre\lib\jsse.jar;C:\Java\j2sdk1.4.1_05\jre\lib\jce.jar;C:\Java\j2sdk1.4.1_05\jre\lib\charsets.jar;C:\Java\j2sdk1.4.1_05\jre\classes, java.vendor=Sun Microsystems Inc., hibernate.jdbc.batch_size=5, connection.driver_class=com.mysql.jdbc.Driver, file.separator=\, java.vendor.url.bug=http://java.sun.com/cgi-bin/bugreport.cgi, sun.cpu.endian=little, sun.io.unicode.encoding=UnicodeLittle, hibernate.use_outer_join=true, connection.url=jdbc:mysql://localhost/hibtest, dialect=net.sf.hibernate.dialect.MySQLDialect, sun.cpu.isalist=pentium i486 i386}
[java] 17:41:09,816 INFO [Configuration] processing one-to-many association mappings
[java] 17:41:09,816 DEBUG [Binder] Second pass for collection: Foo.manyToManyList
[java] 17:41:09,826 DEBUG [Binder] Mapped collection key: foo_id, index: index_num, element: bar_id, type: Bar
[java] 17:41:09,826 INFO [Configuration] processing one-to-one association property references
[java] 17:41:09,826 INFO [Configuration] processing foreign key constraints
[java] 17:41:09,836 DEBUG [Configuration] resolving reference to class: Foo
[java] 17:41:09,836 DEBUG [Configuration] resolving reference to class: Bar
[java] 17:41:09,856 INFO [Dialect] Using dialect: net.sf.hibernate.dialect.MySQLDialect
[java] 17:41:09,856 INFO [SettingsFactory] Use outer join fetching: true
[java] 17:41:09,866 INFO [DriverManagerConnectionProvider] Using Hibernate built-in connection pool (not for production use!)
[java] 17:41:09,866 INFO [DriverManagerConnectionProvider] Hibernate connection pool size: 20
[java] 17:41:09,876 INFO [DriverManagerConnectionProvider] using driver: com.mysql.jdbc.Driver at URL: jdbc:mysql://localhost/hibtest
[java] 17:41:09,876 INFO [DriverManagerConnectionProvider] connection properties: {user=hibtest, password=hibtest}
[java] 17:41:09,876 INFO [TransactionFactoryFactory] Transaction strategy: net.sf.hibernate.transaction.JDBCTransactionFactory
[java] 17:41:09,886 INFO [TransactionManagerLookupFactory] No TransactionManagerLookup configured (in JTA environment, use of process level read-write cache is not recommended)
[java] 17:41:09,886 DEBUG [DriverManagerConnectionProvider] total checked-out connections: 0
[java] 17:41:09,886 DEBUG [DriverManagerConnectionProvider] opening new JDBC connection
[java] 17:41:10,077 DEBUG [DriverManagerConnectionProvider] created connection to: jdbc:mysql://localhost/hibtest, Isolation Level: 4
[java] 17:41:10,087 DEBUG [DriverManagerConnectionProvider] returning connection to pool, pool size: 1
[java] 17:41:10,087 INFO [SettingsFactory] Use scrollable result sets: true
[java] 17:41:10,087 INFO [SettingsFactory] Use JDBC3 getGeneratedKeys(): true
[java] 17:41:10,087 INFO [SettingsFactory] Optimize cache for minimal puts: false
[java] 17:41:10,087 INFO [SettingsFactory] echoing all SQL to stdout
[java] 17:41:10,087 INFO [SettingsFactory] Query language substitutions: {}
[java] 17:41:10,087 INFO [SettingsFactory] cache provider: net.sf.ehcache.hibernate.Provider
[java] 17:41:10,087 INFO [Configuration] instantiating and configuring caches
[java] 17:41:10,217 INFO [SessionFactoryImpl] building session factory
[java] 17:41:10,217 DEBUG [SessionFactoryImpl] instantiating session factory with properties: {hibernate.connection.password=hibtest, java.runtime.name=Java(TM) 2 Runtime Environment, Standard Edition, transaction.factory_class=net.sf.hibernate.transaction.JDBCTransactionFactory, sun.boot.library.path=C:\Java\j2sdk1.4.1_05\jre\bin, java.vm.version=1.4.1_05-b01, hibernate.connection.username=hibtest, ant.library.dir=c:\Java\eclipse\plugins\org.apache.ant_1.6.1\lib, java.vm.vendor=Sun Microsystems Inc., java.vendor.url=http://java.sun.com/, path.separator=;, java.vm.name=Java HotSpot(TM) Client VM, file.encoding.pkg=sun.io, use_outer_join=true, user.country=US, sun.os.patch.level=Service Pack 2, java.vm.specification.name=Java Virtual Machine Specification, user.dir=C:\Java\eclipse\workspace\ManyToManyTest, java.runtime.version=1.4.1_05-b01, java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment, java.endorsed.dirs=C:\Java\j2sdk1.4.1_05\jre\lib\endorsed, os.arch=x86, java.io.tmpdir=C:\DOCUME~1\resnik\LOCALS~1\Temp\, line.separator=
[java] , java.vm.specification.vendor=Sun Microsystems Inc., user.variant=, os.name=Windows XP, ant.home=c:\Java\eclipse\plugins\org.apache.ant_1.6.1, sun.java2d.fontpath=, java.library.path=C:\Java\j2sdk1.4.1_05\bin;.;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\ATI Technologies\ATI Control Panel;C:\Program Files\SecureCRT\;C:\Program Files\Executive Software\Diskeeper\, java.specification.name=Java Platform API Specification, java.class.version=48.0, hibernate.transaction.factory_class=net.sf.hibernate.transaction.JDBCTransactionFactory, java.util.prefs.PreferencesFactory=java.util.prefs.WindowsPreferencesFactory, os.version=5.1, connection.password=hibtest, user.home=C:\Documents and Settings\resnik, user.timezone=America/Chicago, connection.username=hibtest, java.awt.printerjob=sun.awt.windows.WPrinterJob, file.encoding=Cp1252, java.specification.version=1.4, hibernate.connection.driver_class=com.mysql.jdbc.Driver, show_sql=true, user.name=resnik, java.class.path=C:\Java\eclipse\plugins\org.apache.ant_1.6.1\lib\ant.jar;C:\Java\eclipse\plugins\org.apache.ant_1.6.1\lib\ant-antlr.jar;C:\Java\eclipse\plugins\org.apache.ant_1.6.1\lib\ant-apache-bsf.jar;C:\Java\eclipse\plugins\org.apache.ant_1.6.1\lib\ant-apache-resolver.jar;C:\Java\eclipse\plugins\org.apache.ant_1.6.1\lib\ant-commons-logging.jar;C:\Java\eclipse\plugins\org.apache.ant_1.6.1\lib\ant-commons-net.jar;C:\Java\eclipse\plugins\org.apache.ant_1.6.1\lib\ant-icontract.jar;C:\Java\eclipse\plugins\org.apache.ant_1.6.1\lib\ant-jai.jar;C:\Java\eclipse\plugins\org.apache.ant_1.6.1\lib\ant-jakarta-bcel.jar;C:\Java\eclipse\plugins\org.apache.ant_1.6.1\lib\ant-jakarta-log4j.jar;C:\Java\eclipse\plugins\org.apache.ant_1.6.1\lib\ant-jakarta-oro.jar;C:\Java\eclipse\plugins\org.apache.ant_1.6.1\lib\ant-jakarta-regexp.jar;C:\Java\eclipse\plugins\org.apache.ant_1.6.1\lib\ant-javamail.jar;C:\Java\eclipse\plugins\org.apache.ant_1.6.1\lib\ant-jdepend.jar;C:\Java\eclipse\plugins\org.apache.ant_1.6.1\lib\ant-jmf.jar;C:\Java\eclipse\plugins\org.apache.ant_1.6.1\lib\ant-jsch.jar;C:\Java\eclipse\plugins\org.apache.ant_1.6.1\lib\ant-junit.jar;C:\Java\eclipse\plugins\org.apache.ant_1.6.1\lib\ant-launcher.jar;C:\Java\eclipse\plugins\org.apache.ant_1.6.1\lib\ant-netrexx.jar;C:\Java\eclipse\plugins\org.apache.ant_1.6.1\lib\ant-nodeps.jar;C:\Java\eclipse\plugins\org.apache.ant_1.6.1\lib\ant-starteam.jar;C:\Java\eclipse\plugins\org.apache.ant_1.6.1\lib\ant-stylebook.jar;C:\Java\eclipse\plugins\org.apache.ant_1.6.1\lib\ant-swing.jar;C:\Java\eclipse\plugins\org.apache.ant_1.6.1\lib\ant-trax.jar;C:\Java\eclipse\plugins\org.apache.ant_1.6.1\lib\ant-vaj.jar;C:\Java\eclipse\plugins\org.apache.ant_1.6.1\lib\ant-weblogic.jar;C:\Java\eclipse\plugins\org.apache.ant_1.6.1\lib\ant-xalan1.jar;C:\Java\eclipse\plugins\org.apache.ant_1.6.1\lib\ant-xalan2.jar;C:\Java\eclipse\plugins\org.apache.ant_1.6.1\lib\ant-xslp.jar;C:\Java\eclipse\plugins\org.eclipse.ant.ui_3.0.0\lib\remoteAnt.jar;C:\Java\j2sdk1.4.1_05\lib\tools.jar, hibernate.show_sql=true, java.vm.specification.version=1.0, sun.arch.data.model=32, java.home=C:\Java\j2sdk1.4.1_05\jre, jdbc.batch_size=5, hibernate.connection.url=jdbc:mysql://localhost/hibtest, hibernate.dialect=net.sf.hibernate.dialect.MySQLDialect, java.specification.vendor=Sun Microsystems Inc., user.language=en, awt.toolkit=sun.awt.windows.WToolkit, hibernate.cglib.use_reflection_optimizer=true, java.vm.info=mixed mode, java.version=1.4.1_05, java.ext.dirs=C:\Java\j2sdk1.4.1_05\jre\lib\ext, sun.boot.class.path=C:\Java\j2sdk1.4.1_05\jre\lib\rt.jar;C:\Java\j2sdk1.4.1_05\jre\lib\i18n.jar;C:\Java\j2sdk1.4.1_05\jre\lib\sunrsasign.jar;C:\Java\j2sdk1.4.1_05\jre\lib\jsse.jar;C:\Java\j2sdk1.4.1_05\jre\lib\jce.jar;C:\Java\j2sdk1.4.1_05\jre\lib\charsets.jar;C:\Java\j2sdk1.4.1_05\jre\classes, java.vendor=Sun Microsystems Inc., hibernate.jdbc.batch_size=5, connection.driver_class=com.mysql.jdbc.Driver, file.separator=\, java.vendor.url.bug=http://java.sun.com/cgi-bin/bugreport.cgi, sun.cpu.endian=little, sun.io.unicode.encoding=UnicodeLittle, hibernate.use_outer_join=true, connection.url=jdbc:mysql://localhost/hibtest, dialect=net.sf.hibernate.dialect.MySQLDialect, sun.cpu.isalist=pentium i486 i386}
[java] 17:41:10,607 DEBUG [SessionFactoryObjectFactory] initializing class SessionFactoryObjectFactory
[java] 17:41:10,607 DEBUG [SessionFactoryObjectFactory] registered: 4028c595febc289700febc2899cf0000 (unnamed)
[java] 17:41:10,607 INFO [SessionFactoryObjectFactory] no JNDI name configured
[java] 17:41:10,607 DEBUG [SessionFactoryImpl] instantiated session factory
[java] 17:41:10,617 DEBUG [Main] Got SessionFactory.
[java] 17:41:10,678 DEBUG [SessionImpl] opened session
[java] 17:41:10,678 DEBUG [Main] Opened Session.
[java] 17:41:10,678 DEBUG [JDBCTransaction] begin
[java] 17:41:10,678 DEBUG [DriverManagerConnectionProvider] total checked-out connections: 0
[java] 17:41:10,678 DEBUG [DriverManagerConnectionProvider] using pooled JDBC connection, pool size: 0
[java] 17:41:10,688 DEBUG [JDBCTransaction] current autocommit status:false
[java] 17:41:10,688 DEBUG [Main] Began Transaction.
[java] 17:41:10,688 DEBUG [SessionImpl] saving [Foo#<null>]
[java] 17:41:10,688 DEBUG [SessionImpl] executing insertions
[java] 17:41:10,688 DEBUG [Cascades] processing cascades for: Foo
[java] 17:41:10,688 DEBUG [Cascades] done processing cascades for: Foo
[java] 17:41:10,708 DEBUG [WrapVisitor] Wrapped collection in role: Foo.manyToManyList
[java] 17:41:10,708 DEBUG [EntityPersister] Inserting entity: Foo (native id)
[java] 17:41:10,708 DEBUG [BatcherImpl] about to open: 0 open PreparedStatements, 0 open ResultSets
[java] 17:41:10,708 DEBUG [SQL] insert into foo (some_value) values (?)
[java] Hibernate: insert into foo (some_value) values (?)
[java] 17:41:10,708 DEBUG [BatcherImpl] preparing statement
[java] 17:41:10,728 DEBUG [EntityPersister] Dehydrating entity: [Foo#<null>]
[java] 17:41:10,728 DEBUG [StringType] binding 'Parent' to parameter: 1
[java] 17:41:10,728 DEBUG [AbstractEntityPersister] Natively generated identity: 1
[java] 17:41:10,768 DEBUG [BatcherImpl] done closing: 0 open PreparedStatements, 0 open ResultSets
[java] 17:41:10,768 DEBUG [BatcherImpl] closing statement
[java] 17:41:10,778 DEBUG [Cascades] processing cascades for: Foo
[java] 17:41:10,778 DEBUG [Cascades] cascading to collection: Foo.manyToManyList
[java] 17:41:10,778 DEBUG [Cascades] cascading to saveOrUpdate()
[java] 17:41:10,778 DEBUG [Cascades] id unsaved-value: 0
[java] 17:41:10,778 DEBUG [SessionImpl] saveOrUpdate() unsaved instance
[java] 17:41:10,778 DEBUG [SessionImpl] saving [Bar#<null>]
[java] 17:41:10,778 DEBUG [SessionImpl] executing insertions
[java] 17:41:10,778 DEBUG [EntityPersister] Inserting entity: Bar (native id)
[java] 17:41:10,778 DEBUG [BatcherImpl] about to open: 0 open PreparedStatements, 0 open ResultSets
[java] 17:41:10,788 DEBUG [SQL] insert into bar (bar_name) values (?)
[java] Hibernate: insert into bar (bar_name) values (?)
[java] 17:41:10,788 DEBUG [BatcherImpl] preparing statement
[java] 17:41:10,788 DEBUG [EntityPersister] Dehydrating entity: [Bar#<null>]
[java] 17:41:10,788 DEBUG [StringType] binding 'bar1' to parameter: 1
[java] 17:41:10,788 DEBUG [AbstractEntityPersister] Natively generated identity: 1
[java] 17:41:10,788 DEBUG [BatcherImpl] done closing: 0 open PreparedStatements, 0 open ResultSets
[java] 17:41:10,788 DEBUG [BatcherImpl] closing statement
[java] 17:41:10,788 DEBUG [Cascades] cascading to saveOrUpdate()
[java] 17:41:10,788 DEBUG [Cascades] id unsaved-value: 0
[java] 17:41:10,788 DEBUG [SessionImpl] saveOrUpdate() unsaved instance
[java] 17:41:10,788 DEBUG [SessionImpl] saving [Bar#<null>]
[java] 17:41:10,788 DEBUG [SessionImpl] executing insertions
[java] 17:41:10,798 DEBUG [EntityPersister] Inserting entity: Bar (native id)
[java] 17:41:10,798 DEBUG [BatcherImpl] about to open: 0 open PreparedStatements, 0 open ResultSets
[java] 17:41:10,798 DEBUG [SQL] insert into bar (bar_name) values (?)
[java] Hibernate: insert into bar (bar_name) values (?)
[java] 17:41:10,798 DEBUG [BatcherImpl] preparing statement
[java] 17:41:10,798 DEBUG [EntityPersister] Dehydrating entity: [Bar#<null>]
[java] 17:41:10,798 DEBUG [StringType] binding 'bar2' to parameter: 1
[java] 17:41:10,798 DEBUG [AbstractEntityPersister] Natively generated identity: 2
[java] 17:41:10,798 DEBUG [BatcherImpl] done closing: 0 open PreparedStatements, 0 open ResultSets
[java] 17:41:10,798 DEBUG [BatcherImpl] closing statement
[java] 17:41:10,798 DEBUG [Cascades] done processing cascades for: Foo
[java] 17:41:10,798 DEBUG [Main] Saved objects.
[java] 17:41:10,798 DEBUG [JDBCTransaction] commit
[java] 17:41:10,798 DEBUG [SessionImpl] flushing session
[java] 17:41:10,798 DEBUG [Cascades] processing cascades for: Foo
[java] 17:41:10,798 DEBUG [Cascades] cascading to collection: Foo.manyToManyList
[java] 17:41:10,798 DEBUG [Cascades] cascading to saveOrUpdate()
[java] 17:41:10,798 DEBUG [SessionImpl] saveOrUpdate() persistent instance
[java] 17:41:10,798 DEBUG [Cascades] cascading to saveOrUpdate()
[java] 17:41:10,798 DEBUG [SessionImpl] saveOrUpdate() persistent instance
[java] 17:41:10,808 DEBUG [Cascades] done processing cascades for: Foo
[java] 17:41:10,808 DEBUG [SessionImpl] Flushing entities and processing referenced collections
[java] 17:41:10,808 DEBUG [SessionImpl] Collection found: [Foo.manyToManyList#1], was: [<unreferenced>]
[java] 17:41:10,808 DEBUG [SessionImpl] Processing unreferenced collections
[java] 17:41:10,808 DEBUG [SessionImpl] Scheduling collection removes/(re)creates/updates
[java] 17:41:10,818 DEBUG [SessionImpl] Flushed: 0 insertions, 0 updates, 0 deletions to 3 objects
[java] 17:41:10,818 DEBUG [SessionImpl] Flushed: 1 (re)creations, 0 updates, 0 removals to 1 collections
[java] 17:41:10,818 DEBUG [Printer] listing entities:
[java] 17:41:10,818 DEBUG [Printer] Bar{barName=bar2, barId=2}
[java] 17:41:10,828 DEBUG [Printer] Foo{manyToManyList=[Bar#1, Bar#2], someValue=Parent, fooId=1}
[java] 17:41:10,828 DEBUG [Printer] Bar{barName=bar1, barId=1}
[java] 17:41:10,828 DEBUG [SessionImpl] executing flush
[java] 17:41:10,828 DEBUG [BasicCollectionPersister] Inserting collection: [Foo.manyToManyList#1]
[java] 17:41:10,828 DEBUG [BatcherImpl] about to open: 0 open PreparedStatements, 0 open ResultSets
[java] 17:41:10,828 DEBUG [SQL] insert into foo_bar (foo_id, index_num, bar_id) values (?, ?, ?)
[java] Hibernate: insert into foo_bar (foo_id, index_num, bar_id) values (?, ?, ?)
[java] 17:41:10,828 DEBUG [BatcherImpl] preparing statement
[java] 17:41:10,828 DEBUG [LongType] binding '1' to parameter: 1
[java] 17:41:10,828 DEBUG [LongType] binding '1' to parameter: 3
[java] 17:41:10,828 DEBUG [IntegerType] binding '0' to parameter: 2
[java] 17:41:10,828 DEBUG [BatcherImpl] Adding to batch
[java] 17:41:10,838 DEBUG [LongType] binding '1' to parameter: 1
[java] 17:41:10,838 DEBUG [LongType] binding '2' to parameter: 3
[java] 17:41:10,838 DEBUG [IntegerType] binding '1' to parameter: 2
[java] 17:41:10,838 DEBUG [BatcherImpl] Adding to batch
[java] 17:41:10,838 DEBUG [BasicCollectionPersister] done inserting collection: 2 rows inserted
[java] 17:41:10,838 DEBUG [BatcherImpl] Executing batch size: 2
[java] 17:41:10,838 DEBUG [BatcherImpl] done closing: 0 open PreparedStatements, 0 open ResultSets
[java] 17:41:10,838 DEBUG [BatcherImpl] closing statement
[java] 17:41:10,848 DEBUG [SessionImpl] post flush
[java] 17:41:10,888 DEBUG [SessionImpl] transaction completion
[java] 17:41:10,888 DEBUG [Main] Committed transaction.
[java] 17:41:10,888 DEBUG [SessionImpl] closing session
[java] 17:41:10,888 DEBUG [SessionImpl] disconnecting session
[java] 17:41:10,888 DEBUG [DriverManagerConnectionProvider] returning connection to pool, pool size: 1
[java] 17:41:10,888 DEBUG [SessionImpl] transaction completion
[java] 17:41:10,888 DEBUG [SessionImpl] opened session
[java] 17:41:10,888 DEBUG [Main] Opened Session 2.
[java] 17:41:10,888 DEBUG [JDBCTransaction] begin
[java] 17:41:10,888 DEBUG [DriverManagerConnectionProvider] total checked-out connections: 0
[java] 17:41:10,898 DEBUG [DriverManagerConnectionProvider] using pooled JDBC connection, pool size: 0
[java] 17:41:10,898 DEBUG [JDBCTransaction] current autocommit status:false
[java] 17:41:10,898 DEBUG [Main] Began Transaction 2.
[java] 17:41:10,898 DEBUG [SessionImpl] loading [Foo#1]
[java] 17:41:10,898 DEBUG [SessionImpl] attempting to resolve [Foo#1]
[java] 17:41:10,898 DEBUG [SessionImpl] object not resolved in any cache [Foo#1]
[java] 17:41:10,898 DEBUG [EntityPersister] Materializing entity: [Foo#1]
[java] 17:41:10,898 DEBUG [BatcherImpl] about to open: 0 open PreparedStatements, 0 open ResultSets
[java] 17:41:10,908 DEBUG [SQL] select foo0_.foo_id as foo_id0_, foo0_.some_value as some_value0_ from foo foo0_ where foo0_.foo_id=?
[java] Hibernate: select foo0_.foo_id as foo_id0_, foo0_.some_value as some_value0_ from foo foo0_ where foo0_.foo_id=?
[java] 17:41:10,908 DEBUG [BatcherImpl] preparing statement
[java] 17:41:10,908 DEBUG [LongType] binding '1' to parameter: 1
[java] 17:41:10,908 DEBUG [Loader] processing result set
[java] 17:41:10,908 DEBUG [Loader] result row: 1
[java] 17:41:10,908 DEBUG [Loader] Initializing object from ResultSet: 1
[java] 17:41:10,908 DEBUG [Loader] Hydrating entity: Foo#1
[java] 17:41:10,918 DEBUG [StringType] returning 'Parent' as column: some_value0_
[java] 17:41:10,918 DEBUG [Loader] done processing result set (1 rows)
[java] 17:41:10,918 DEBUG [BatcherImpl] done closing: 0 open PreparedStatements, 0 open ResultSets
[java] 17:41:10,918 DEBUG [BatcherImpl] closing statement
[java] 17:41:10,918 DEBUG [Loader] total objects hydrated: 1
[java] 17:41:10,918 DEBUG [SessionImpl] resolving associations for [Foo#1]
[java] 17:41:10,918 DEBUG [SessionImpl] creating collection wrapper:[Foo.manyToManyList#1]
[java] 17:41:10,918 DEBUG [SessionImpl] done materializing entity [Foo#1]
[java] 17:41:10,918 DEBUG [SessionImpl] initializing non-lazy collections
[java] 17:41:10,918 DEBUG [Main] Got foo object: Foo@1a2f02e
[java] 17:41:10,918 DEBUG [SessionImpl] initializing collection [Foo.manyToManyList#1]
[java] 17:41:10,918 DEBUG [SessionImpl] checking second-level cache
[java] 17:41:10,918 DEBUG [SessionImpl] collection not cached
[java] 17:41:10,918 DEBUG [BatcherImpl] about to open: 0 open PreparedStatements, 0 open ResultSets
[java] 17:41:10,918 DEBUG [SQL] select manytomany0_.bar_id as bar_id__, manytomany0_.foo_id as foo_id__, manytomany0_.index_num as index_num__, bar1_.bar_id as bar_id0_, bar1_.bar_name as bar_name0_ from foo_bar manytomany0_ inner join bar bar1_ on manytomany0_.bar_id=bar1_.bar_id where manytomany0_.foo_id=?
[java] Hibernate: select manytomany0_.bar_id as bar_id__, manytomany0_.foo_id as foo_id__, manytomany0_.index_num as index_num__, bar1_.bar_id as bar_id0_, bar1_.bar_name as bar_name0_ from foo_bar manytomany0_ inner join bar bar1_ on manytomany0_.bar_id=bar1_.bar_id where manytomany0_.foo_id=?
[java] 17:41:10,918 DEBUG [BatcherImpl] preparing statement
[java] 17:41:10,928 DEBUG [LongType] binding '1' to parameter: 1
[java] 17:41:10,928 DEBUG [Loader] result set contains (possibly empty) collection: [Foo.manyToManyList#1]
[java] 17:41:10,928 DEBUG [SessionImpl] uninitialized collection: initializing
[java] 17:41:10,928 DEBUG [Loader] processing result set
[java] 17:41:10,928 DEBUG [LongType] returning '1' as column: bar_id0_
[java] 17:41:10,938 DEBUG [Loader] result row: 1
[java] 17:41:10,938 DEBUG [Loader] Initializing object from ResultSet: 1
[java] 17:41:10,938 DEBUG [Loader] Hydrating entity: Bar#1
[java] 17:41:10,938 DEBUG [StringType] returning 'bar1' as column: bar_name0_
[java] 17:41:10,938 DEBUG [LongType] returning '1' as column: foo_id__
[java] 17:41:10,938 DEBUG [Loader] found row of collection: [Foo.manyToManyList#1]
[java] 17:41:10,938 DEBUG [SessionImpl] reading row
[java] 17:41:10,938 DEBUG [LongType] returning '1' as column: bar_id__
[java] 17:41:10,938 DEBUG [SessionImpl] loading [Bar#1]
[java] 17:41:10,938 DEBUG [SessionImpl] attempting to resolve [Bar#1]
[java] 17:41:10,938 DEBUG [SessionImpl] resolved object in session cache [Bar#1]
[java] 17:41:10,938 DEBUG [IntegerType] returning '0' as column: index_num__
[java] 17:41:10,938 DEBUG [LongType] returning '2' as column: bar_id0_
[java] 17:41:10,938 DEBUG [Loader] result row: 2
[java] 17:41:10,938 DEBUG [Loader] Initializing object from ResultSet: 2
[java] 17:41:10,938 DEBUG [Loader] Hydrating entity: Bar#2
[java] 17:41:10,938 DEBUG [StringType] returning 'bar2' as column: bar_name0_
[java] 17:41:10,948 DEBUG [LongType] returning '1' as column: foo_id__
[java] 17:41:10,948 DEBUG [Loader] found row of collection: [Foo.manyToManyList#1]
[java] 17:41:10,948 DEBUG [SessionImpl] reading row
[java] 17:41:10,948 DEBUG [LongType] returning '2' as column: bar_id__
[java] 17:41:10,948 DEBUG [SessionImpl] loading [Bar#2]
[java] 17:41:10,948 DEBUG [SessionImpl] attempting to resolve [Bar#2]
[java] 17:41:10,948 DEBUG [SessionImpl] resolved object in session cache [Bar#2]
[java] 17:41:10,948 DEBUG [IntegerType] returning '1' as column: index_num__
[java] 17:41:10,948 DEBUG [Loader] done processing result set (2 rows)
[java] 17:41:10,948 DEBUG [BatcherImpl] done closing: 0 open PreparedStatements, 0 open ResultSets
[java] 17:41:10,948 DEBUG [BatcherImpl] closing statement
[java] 17:41:10,948 DEBUG [Loader] total objects hydrated: 2
[java] 17:41:10,958 DEBUG [SessionImpl] resolving associations for [Bar#1]
[java] 17:41:10,958 DEBUG [SessionImpl] done materializing entity [Bar#1]
[java] 17:41:10,958 DEBUG [SessionImpl] resolving associations for [Bar#2]
[java] 17:41:10,958 DEBUG [SessionImpl] done materializing entity [Bar#2]
[java] 17:41:10,958 DEBUG [SessionImpl] 1 collections were found in result set
[java] 17:41:10,958 DEBUG [SessionImpl] collection fully initialized: [Foo.manyToManyList#1]
[java] 17:41:10,958 DEBUG [SessionImpl] 1 collections initialized
[java] 17:41:10,958 DEBUG [SessionImpl] initializing non-lazy collections
[java] 17:41:10,958 DEBUG [SessionImpl] collection initialized
[java] 17:41:10,958 DEBUG [Main] Got bar object: Bar@504ec1
[java] 17:41:10,958 DEBUG [Main] Removed and added bar objects.
[java] 17:41:10,958 DEBUG [SessionImpl] object already associated with session
[java] 17:41:10,958 DEBUG [Main] Updated object.
[java] 17:41:10,958 DEBUG [JDBCTransaction] commit
[java] 17:41:10,958 DEBUG [SessionImpl] flushing session
[java] 17:41:10,968 DEBUG [Cascades] processing cascades for: Foo
[java] 17:41:10,968 DEBUG [Cascades] cascading to collection: Foo.manyToManyList
[java] 17:41:10,968 DEBUG [Cascades] cascading to saveOrUpdate()
[java] 17:41:10,968 DEBUG [SessionImpl] saveOrUpdate() persistent instance
[java] 17:41:10,968 DEBUG [Cascades] cascading to saveOrUpdate()
[java] 17:41:10,968 DEBUG [Cascades] id unsaved-value: 0
[java] 17:41:10,968 DEBUG [SessionImpl] saveOrUpdate() unsaved instance
[java] 17:41:10,968 DEBUG [SessionImpl] saving [Bar#<null>]
[java] 17:41:10,968 DEBUG [SessionImpl] executing insertions
[java] 17:41:10,968 DEBUG [EntityPersister] Inserting entity: Bar (native id)
[java] 17:41:10,968 DEBUG [BatcherImpl] about to open: 0 open PreparedStatements, 0 open ResultSets
[java] 17:41:10,968 DEBUG [SQL] insert into bar (bar_name) values (?)
[java] Hibernate: insert into bar (bar_name) values (?)
[java] 17:41:10,968 DEBUG [BatcherImpl] preparing statement
[java] 17:41:10,978 DEBUG [EntityPersister] Dehydrating entity: [Bar#<null>]
[java] 17:41:10,978 DEBUG [StringType] binding 'bar3' to parameter: 1
[java] 17:41:10,978 DEBUG [AbstractEntityPersister] Natively generated identity: 3
[java] 17:41:10,978 DEBUG [BatcherImpl] done closing: 0 open PreparedStatements, 0 open ResultSets
[java] 17:41:10,978 DEBUG [BatcherImpl] closing statement
[java] 17:41:10,978 DEBUG [Cascades] done processing cascades for: Foo
[java] 17:41:10,978 DEBUG [SessionImpl] Collection dirty: [Foo.manyToManyList#1]
[java] 17:41:10,978 DEBUG [SessionImpl] Flushing entities and processing referenced collections
[java] 17:41:10,978 DEBUG [SessionImpl] Collection found: [Foo.manyToManyList#1], was: [Foo.manyToManyList#1]
[java] 17:41:10,978 DEBUG [SessionImpl] Processing unreferenced collections
[java] 17:41:10,978 DEBUG [SessionImpl] Scheduling collection removes/(re)creates/updates
[java] 17:41:10,978 DEBUG [SessionImpl] Flushed: 0 insertions, 0 updates, 0 deletions to 4 objects
[java] 17:41:10,978 DEBUG [SessionImpl] Flushed: 0 (re)creations, 1 updates, 0 removals to 1 collections
[java] 17:41:10,978 DEBUG [Printer] listing entities:
[java] 17:41:10,978 DEBUG [Printer] Bar{barName=bar2, barId=2}
[java] 17:41:10,988 DEBUG [Printer] Foo{manyToManyList=[Bar#2, Bar#3], someValue=Parent, fooId=1}
[java] 17:41:10,988 DEBUG [Printer] Bar{barName=bar3, barId=3}
[java] 17:41:10,988 DEBUG [Printer] Bar{barName=bar1, barId=1}
[java] 17:41:10,988 DEBUG [SessionImpl] executing flush
[java] 17:41:10,988 DEBUG [BasicCollectionPersister] Deleting rows of collection: [Foo.manyToManyList#1]
[java] 17:41:10,988 DEBUG [BasicCollectionPersister] no rows to delete
[java] 17:41:10,988 DEBUG [BasicCollectionPersister] Updating rows of collection: Foo.manyToManyList#1
[java] 17:41:10,988 DEBUG [BatcherImpl] about to open: 0 open PreparedStatements, 0 open ResultSets
[java] 17:41:10,988 DEBUG [SQL] update foo_bar set bar_id=? where foo_id=? and index_num=?
[java] Hibernate: update foo_bar set bar_id=? where foo_id=? and index_num=?
[java] 17:41:10,988 DEBUG [BatcherImpl] preparing statement
[java] 17:41:10,988 DEBUG [LongType] binding '1' to parameter: 2
[java] 17:41:10,988 DEBUG [LongType] binding '2' to parameter: 1
[java] 17:41:10,988 DEBUG [IntegerType] binding '0' to parameter: 3
[java] 17:41:11,028 DEBUG [BatcherImpl] Adding to batch
[java] 17:41:11,028 DEBUG [LongType] binding '1' to parameter: 2
[java] 17:41:11,028 DEBUG [LongType] binding '3' to parameter: 1
[java] 17:41:11,028 DEBUG [IntegerType] binding '1' to parameter: 3
[java] 17:41:11,028 DEBUG [BatcherImpl] Adding to batch
[java] 17:41:11,028 DEBUG [BasicCollectionPersister] done updating rows: 2 updated
[java] 17:41:11,028 DEBUG [BasicCollectionPersister] Inserting rows of collection: [Foo.manyToManyList#1]
[java] 17:41:11,028 DEBUG [BasicCollectionPersister] done inserting rows: 0 inserted
[java] 17:41:11,028 DEBUG [BatcherImpl] Executing batch size: 2
[java] 17:41:11,038 DEBUG [JDBCExceptionReporter] SQL Exception
[java] java.sql.BatchUpdateException: null, message from server: "Duplicate entry '1-2' for key 1"
[java] at com.mysql.jdbc.PreparedStatement.executeBatch(PreparedStatement.java:1404)
[java] at net.sf.hibernate.impl.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:54)
[java] at net.sf.hibernate.impl.BatcherImpl.executeBatch(BatcherImpl.java:122)
[java] at net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2417)
[java] at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2370)
[java] at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2236)
[java] at net.sf.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:61)
[java] at Main.main(Unknown Source)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[java] at java.lang.reflect.Method.invoke(Method.java:324)
[java] at org.apache.tools.ant.taskdefs.ExecuteJava.run(ExecuteJava.java:196)
[java] at org.apache.tools.ant.taskdefs.ExecuteJava.execute(ExecuteJava.java:133)
[java] at org.apache.tools.ant.taskdefs.Java.run(Java.java:661)
[java] at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:168)
[java] at org.apache.tools.ant.taskdefs.Java.execute(Java.java:77)
[java] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:269)
[java] at org.apache.tools.ant.Task.perform(Task.java:364)
[java] at org.apache.tools.ant.Target.execute(Target.java:301)
[java] at org.apache.tools.ant.Target.performTasks(Target.java:328)
[java] at org.apache.tools.ant.Project.executeTarget(Project.java:1215)
[java] at org.apache.tools.ant.Project.executeTargets(Project.java:1063)
[java] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:377)
[java] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:135)
[java] 17:41:11,058 WARN [JDBCExceptionReporter] SQL Error: 1062, SQLState: 23000
[java] 17:41:11,058 ERROR [JDBCExceptionReporter] null, message from server: "Duplicate entry '1-2' for key 1"
[java] 17:41:11,058 DEBUG [BatcherImpl] done closing: 0 open PreparedStatements, 0 open ResultSets
[java] 17:41:11,058 DEBUG [BatcherImpl] closing statement
[java] 17:41:11,058 DEBUG [JDBCExceptionReporter] SQL Exception
[java] java.sql.BatchUpdateException: null, message from server: "Duplicate entry '1-2' for key 1"
[java] at com.mysql.jdbc.PreparedStatement.executeBatch(PreparedStatement.java:1404)
[java] at net.sf.hibernate.impl.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:54)
[java] at net.sf.hibernate.impl.BatcherImpl.executeBatch(BatcherImpl.java:122)
[java] at net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2417)
[java] at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2370)
[java] at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2236)
[java] at net.sf.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:61)
[java] at Main.main(Unknown Source)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[java] at java.lang.reflect.Method.invoke(Method.java:324)
[java] at org.apache.tools.ant.taskdefs.ExecuteJava.run(ExecuteJava.java:196)
[java] at org.apache.tools.ant.taskdefs.ExecuteJava.execute(ExecuteJava.java:133)
[java] at org.apache.tools.ant.taskdefs.Java.run(Java.java:661)
[java] at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:168)
[java] at org.apache.tools.ant.taskdefs.Java.execute(Java.java:77)
[java] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:269)
[java] at org.apache.tools.ant.Task.perform(Task.java:364)
[java] at org.apache.tools.ant.Target.execute(Target.java:301)
[java] at org.apache.tools.ant.Target.performTasks(Target.java:328)
[java] at org.apache.tools.ant.Project.executeTarget(Project.java:1215)
[java] at org.apache.tools.ant.Project.executeTargets(Project.java:1063)
[java] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:377)
[java] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:135)
[java] 17:41:11,078 WARN [JDBCExceptionReporter] SQL Error: 1062, SQLState: 23000
[java] 17:41:11,078 ERROR [JDBCExceptionReporter] null, message from server: "Duplicate entry '1-2' for key 1"
[java] 17:41:11,078 ERROR [JDBCExceptionReporter] Could not execute JDBC batch update
[java] java.sql.BatchUpdateException: null, message from server: "Duplicate entry '1-2' for key 1"
[java] at com.mysql.jdbc.PreparedStatement.executeBatch(PreparedStatement.java:1404)
[java] at net.sf.hibernate.impl.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:54)
[java] at net.sf.hibernate.impl.BatcherImpl.executeBatch(BatcherImpl.java:122)
[java] at net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2417)
[java] at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2370)
[java] at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2236)
[java] at net.sf.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:61)
[java] at Main.main(Unknown Source)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[java] at java.lang.reflect.Method.invoke(Method.java:324)
[java] at org.apache.tools.ant.taskdefs.ExecuteJava.run(ExecuteJava.java:196)
[java] at org.apache.tools.ant.taskdefs.ExecuteJava.execute(ExecuteJava.java:133)
[java] at org.apache.tools.ant.taskdefs.Java.run(Java.java:661)
[java] at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:168)
[java] at org.apache.tools.ant.taskdefs.Java.execute(Java.java:77)
[java] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:269)
[java] at org.apache.tools.ant.Task.perform(Task.java:364)
[java] at org.apache.tools.ant.Target.execute(Target.java:301)
[java] at org.apache.tools.ant.Target.performTasks(Target.java:328)
[java] at org.apache.tools.ant.Project.executeTarget(Project.java:1215)
[java] at org.apache.tools.ant.Project.executeTargets(Project.java:1063)
[java] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:377)
[java] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:135)
[java] 17:41:11,088 ERROR [SessionImpl] Could not synchronize database state with session
[java] net.sf.hibernate.JDBCException: Could not execute JDBC batch update
[java] at net.sf.hibernate.impl.BatcherImpl.executeBatch(BatcherImpl.java:129)
[java] at net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2417)
[java] at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2370)
[java] at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2236)
[java] at net.sf.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:61)
[java] at Main.main(Unknown Source)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[java] at java.lang.reflect.Method.invoke(Method.java:324)
[java] at org.apache.tools.ant.taskdefs.ExecuteJava.run(ExecuteJava.java:196)
[java] at org.apache.tools.ant.taskdefs.ExecuteJava.execute(ExecuteJava.java:133)
[java] at org.apache.tools.ant.taskdefs.Java.run(Java.java:661)
[java] at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:168)
[java] at org.apache.tools.ant.taskdefs.Java.execute(Java.java:77)
[java] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:269)
[java] at org.apache.tools.ant.Task.perform(Task.java:364)
[java] at org.apache.tools.ant.Target.execute(Target.java:301)
[java] at org.apache.tools.ant.Target.performTasks(Target.java:328)
[java] at org.apache.tools.ant.Project.executeTarget(Project.java:1215)
[java] at org.apache.tools.ant.Project.executeTargets(Project.java:1063)
[java] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:377)
[java] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:135)
[java] Caused by: java.sql.BatchUpdateException: null, message from server: "Duplicate entry '1-2' for key 1"
[java] at com.mysql.jdbc.PreparedStatement.executeBatch(PreparedStatement.java:1404)
[java] at net.sf.hibernate.impl.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:54)
[java] at net.sf.hibernate.impl.BatcherImpl.executeBatch(BatcherImpl.java:122)
[java] ... 22 more
[java] 17:41:11,108 DEBUG [JDBCTransaction] rollback
[java] 17:41:11,148 DEBUG [SessionImpl] transaction completion
[java] 17:41:11,148 DEBUG [SessionImpl] closing session
[java] 17:41:11,148 DEBUG [SessionImpl] disconnecting session
[java] 17:41:11,148 DEBUG [DriverManagerConnectionProvider] returning connection to pool, pool size: 1
[java] 17:41:11,148 DEBUG [SessionImpl] transaction completion
[java] 17:41:11,148 ERROR [Main] Error changing bar objects.
[java] net.sf.hibernate.JDBCException: Could not execute JDBC batch update
[java] at net.sf.hibernate.impl.BatcherImpl.executeBatch(BatcherImpl.java:129)
[java] at net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2417)
[java] at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2370)
[java] at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2236)
[java] at net.sf.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:61)
[java] at Main.main(Unknown Source)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[java] at java.lang.reflect.Method.invoke(Method.java:324)
[java] at org.apache.tools.ant.taskdefs.ExecuteJava.run(ExecuteJava.java:196)
[java] at org.apache.tools.ant.taskdefs.ExecuteJava.execute(ExecuteJava.java:133)
[java] at org.apache.tools.ant.taskdefs.Java.run(Java.java:661)
[java] at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:168)
[java] at org.apache.tools.ant.taskdefs.Java.execute(Java.java:77)
[java] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:269)
[java] at org.apache.tools.ant.Task.perform(Task.java:364)
[java] at org.apache.tools.ant.Target.execute(Target.java:301)
[java] at org.apache.tools.ant.Target.performTasks(Target.java:328)
[java] at org.apache.tools.ant.Project.executeTarget(Project.java:1215)
[java] at org.apache.tools.ant.Project.executeTargets(Project.java:1063)
[java] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:377)
[java] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:135)
[java] Caused by: java.sql.BatchUpdateException: null, message from server: "Duplicate entry '1-2' for key 1"
[java] at com.mysql.jdbc.PreparedStatement.executeBatch(PreparedStatement.java:1404)
[java] at net.sf.hibernate.impl.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:54)
[java] at net.sf.hibernate.impl.BatcherImpl.executeBatch(BatcherImpl.java:122)
[java] ... 22 more
[java] 17:41:11,168 DEBUG [SessionImpl] closing session