-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Insert before delete causing constraint violation exception
PostPosted: Thu Sep 21, 2006 8:03 pm 
Expert
Expert

Joined: Fri Nov 07, 2003 4:24 am
Posts: 315
Location: Cape Town, South Africa
Hi,

Hibernate 3.2 cr2

I have a table (middle_table) which joins two other tables (left_table and right_table). middle_table is not a pure link table - it contains some other attributes, but the combination of left_id and right_id are unique for the middle_table

left_table 1--------* middle_table *------------1 right table

When I remove the middle entries from the left and right tables in the same transaction that I add another entry for the same left and right combination, I get a constraint violation. It appears as if the delete is scheduled for AFTER the insert. Adding the line session.flush() between the 'delete' and the 'insert' solves the problem. BUT - I don't have access to the session in my object model (for obvious reasons) and wonder how one can get around this.

Mapping documents:
Left.hbm.xml
Code:
<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE hibernate-mapping PUBLIC
    "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
   
<hibernate-mapping
>
    <class
        name="com.sadalbari.test.Left"
        table="left_table">

        <id
            name="id"
            column="id"
            type="java.lang.Long"
            unsaved-value="null">
            <generator class="native" />
        </id>

        <set
            name="middles"
            inverse="true"
            cascade="all-delete-orphan">
              <key column="left_id" />
              <one-to-many class="com.sadalbari.test.Middle" />
        </set>

    </class>

</hibernate-mapping>

Middle.hbm.xml
Code:
<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE hibernate-mapping PUBLIC
    "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
   
<hibernate-mapping
>
    <class
        name="com.sadalbari.test.Middle"
        table="middle_table">

        <id
            name="id"
            column="id"
            type="java.lang.Long"
            unsaved-value="null">
                <generator class="native" />
        </id>
       
        <many-to-one
            name="left"
            class="com.sadalbari.test.Left"
            foreign-key="fk_middle_left">
           <column
              name = "left_id"
              not-null = "true"
              unique-key = "uniq_middle" />
       
        </many-to-one>
       
        <many-to-one
            name="Right"
            class="com.sadalbari.test.Right"
            foreign-key="fk_middle_right">
         <column
              name = "right_id"
              not-null = "true"
              unique-key = "uniq_middle" />
       </many-to-one>

    </class>

</hibernate-mapping>

Right.hbm.xml
Code:
<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE hibernate-mapping PUBLIC
    "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
   
<hibernate-mapping
>
    <class
        name="com.sadalbari.test.Right"
        table="right_table"
    >

        <id
            name="id"
            column="id"
            type="java.lang.Long"
            unsaved-value="null">
                <generator class="native" />
        </id>

        <set
            name="middles"
            inverse="true"
            cascade="delete-orphan">
                <key column="right_id" />
                <one-to-many class="com.sadalbari.test.Middle" />
        </set>

    </class>

</hibernate-mapping>

Left.java
Code:
package com.sadalbari.test;

import java.util.HashSet;
import java.util.Set;

public class Left {
   
    private Long id;
    private Set<Middle> middles = new HashSet<Middle>();
   
    public void addMiddle(Middle toAdd) {
        toAdd.setLeft(this);
        middles.add(toAdd);
    }

    public Set<Middle> getMiddles() {
        return middles;
    }

    public void setMiddles(Set<Middle> middles) {
        this.middles = middles;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }
}

Middle.java
Code:
package com.sadalbari.test;

public class Middle {
   
    private Long id;
    private String code;
    private Left left;
    private Right right;
   
    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }
   
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    public Left getLeft() {
        return left;
    }
    public void setLeft(Left left) {
        this.left = left;
    }
    public Right getRight() {
        return right;
    }
    public void setRight(Right right) {
        this.right = right;
    }
   

}

Right.java
Code:
package com.sadalbari.test;

import java.util.HashSet;
import java.util.Set;

public class Right {
   
    private Long id;
    private Set<Middle> middles = new HashSet<Middle>();
   
    public void addMiddle(Middle toAdd) {
        toAdd.setRight(this);
        middles.add(toAdd);
    }

    public Set<Middle> getMiddles() {
        return middles;
    }

    public void setMiddles(Set<Middle> middles) {
        this.middles = middles;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

}

Test class
Code:
package com.sadalbari.test;

import junit.framework.Assert;

import org.hibernate.LockMode;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.hibernate.cfg.Configuration;

public class Test {

    /**
     * @param args
     */
    public static void main(String[] args) {
       
        Configuration cfg = new Configuration();
        cfg.addClass(Left.class);
        cfg.addClass(Middle.class);
        cfg.addClass(Right.class);
        SessionFactory sf = cfg.buildSessionFactory();
       
       
        // -------------------------------
        // Add the entities
        // -------------------------------
        Session session = sf.openSession();
        Transaction tx = session.beginTransaction();
       
        Left left = new Left();
        Right right = new Right();
        Middle middle = new Middle();
       
        session.save(left);
        session.save(right);
       
        left.addMiddle(middle);
        right.addMiddle(middle);
       
        tx.commit();
        session.close();
       
        // -------------------------------
        // delete the middle
        // -------------------------------
       
        session = sf.openSession();
        tx = session.beginTransaction();
       
        session.lock(left, LockMode.NONE);
        session.lock(right, LockMode.NONE);
        session.lock(middle, LockMode.NONE);
               
        left.getMiddles().clear();
       
//        session.flush();
       
        // but now recreate the relationship with a new middle
        Middle middle2 = new Middle();
        left.addMiddle(middle2);
        right.addMiddle(middle2);
       
        tx.commit();
        session.close();
       
        // -------------------------------
        // check that the middle has been deleted
        // -------------------------------
       
        session = sf.openSession();
        tx = session.beginTransaction();
       
        middle = (Middle)session.get(Middle.class, middle.getId());
        Assert.assertNull(middle);
       
        tx.commit();
        session.close();
       
        sf.close();     
    }

}

hibernate.properties
Code:
hibernate.connection.driver_class=org.postgresql.Driver
hibernate.connection.url=jdbc:postgresql:foo
hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
hibernate.connection.username=foo
hibernate.connection.password=bar
hibernate.show_sql=true
hibernate.hbm2ddl.auto=update


Debug trace
Code:
02:05:35,653 INFO  [Environment] Hibernate 3.2 cr2
02:05:35,657 INFO  [Environment] loaded properties from resource hibernate.properties: {hibernate.connection.username=ewage, hibernate.connection.password=****, hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect, hibernate.show_sql=true, hibernate.connection.url=jdbc:postgresql:ewage, hibernate.bytecode.use_reflection_optimizer=false, hibernate.connection.driver_class=org.postgresql.Driver}
02:05:35,658 INFO  [Environment] Bytecode provider name : cglib
02:05:35,669 INFO  [Environment] using JDK 1.4 java.sql.Timestamp handling
02:05:35,735 INFO  [Configuration] Reading mappings from resource: com/sadalbari/test/Left.hbm.xml
02:05:35,783 DEBUG [DTDEntityResolver] trying to resolve system-id [http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd]
02:05:35,783 DEBUG [DTDEntityResolver] recognized hibernate namespace; attempting to resolve on classpath under org/hibernate/
02:05:35,786 DEBUG [DTDEntityResolver] located [http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd] in classpath
02:05:35,924 INFO  [HbmBinder] Mapping class: com.sadalbari.test.Left -> left_table
02:05:35,932 DEBUG [HbmBinder] Mapped property: id -> id
02:05:35,947 DEBUG [HbmBinder] Mapped property: middles
02:05:35,947 INFO  [Configuration] Reading mappings from resource: com/sadalbari/test/Middle.hbm.xml
02:05:35,948 DEBUG [DTDEntityResolver] trying to resolve system-id [http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd]
02:05:35,948 DEBUG [DTDEntityResolver] recognized hibernate namespace; attempting to resolve on classpath under org/hibernate/
02:05:35,951 DEBUG [DTDEntityResolver] located [http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd] in classpath
02:05:35,990 INFO  [HbmBinder] Mapping class: com.sadalbari.test.Middle -> middle_table
02:05:35,990 DEBUG [HbmBinder] Mapped property: id -> id
02:05:36,061 DEBUG [HbmBinder] Mapped property: left -> left_id
02:05:36,061 DEBUG [HbmBinder] Mapped property: Right -> right_id
02:05:36,062 INFO  [Configuration] Reading mappings from resource: com/sadalbari/test/Right.hbm.xml
02:05:36,063 DEBUG [DTDEntityResolver] trying to resolve system-id [http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd]
02:05:36,063 DEBUG [DTDEntityResolver] recognized hibernate namespace; attempting to resolve on classpath under org/hibernate/
02:05:36,063 DEBUG [DTDEntityResolver] located [http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd] in classpath
02:05:36,106 INFO  [HbmBinder] Mapping class: com.sadalbari.test.Right -> right_table
02:05:36,107 DEBUG [HbmBinder] Mapped property: id -> id
02:05:36,107 DEBUG [HbmBinder] Mapped property: middles
02:05:36,107 DEBUG [Configuration] Preparing to build session factory with filters : {}
02:05:36,108 DEBUG [Configuration] processing extends queue
02:05:36,108 DEBUG [Configuration] processing collection mappings
02:05:36,109 DEBUG [CollectionSecondPass] Second pass for collection: com.sadalbari.test.Left.middles
02:05:36,109 INFO  [HbmBinder] Mapping collection: com.sadalbari.test.Left.middles -> middle_table
02:05:36,109 DEBUG [CollectionSecondPass] Mapped collection key: left_id, one-to-many: com.sadalbari.test.Middle
02:05:36,109 DEBUG [CollectionSecondPass] Second pass for collection: com.sadalbari.test.Right.middles
02:05:36,109 INFO  [HbmBinder] Mapping collection: com.sadalbari.test.Right.middles -> middle_table
02:05:36,109 DEBUG [CollectionSecondPass] Mapped collection key: right_id, one-to-many: com.sadalbari.test.Middle
02:05:36,109 DEBUG [Configuration] processing native query and ResultSetMapping mappings
02:05:36,110 DEBUG [Configuration] processing association property references
02:05:36,110 DEBUG [Configuration] processing foreign key constraints
02:05:36,110 DEBUG [Configuration] resolving reference to class: com.sadalbari.test.Left
02:05:36,110 DEBUG [Configuration] resolving reference to class: com.sadalbari.test.Right
02:05:36,121 INFO  [DriverManagerConnectionProvider] Using Hibernate built-in connection pool (not for production use!)
02:05:36,121 INFO  [DriverManagerConnectionProvider] Hibernate connection pool size: 20
02:05:36,122 INFO  [DriverManagerConnectionProvider] autocommit mode: false
02:05:36,126 INFO  [DriverManagerConnectionProvider] using driver: org.postgresql.Driver at URL: jdbc:postgresql:ewage
02:05:36,126 INFO  [DriverManagerConnectionProvider] connection properties: {user=ewage, password=ewage123}
02:05:36,127 DEBUG [DriverManagerConnectionProvider] total checked-out connections: 0
02:05:36,127 DEBUG [DriverManagerConnectionProvider] opening new JDBC connection
02:05:36,233 DEBUG [DriverManagerConnectionProvider] created connection to: jdbc:postgresql:ewage, Isolation Level: 2
02:05:36,251 INFO  [SettingsFactory] RDBMS: PostgreSQL, version: 8.1.4
02:05:36,252 INFO  [SettingsFactory] JDBC driver: PostgreSQL Native Driver, version: PostgreSQL 8.1 JDBC3 with SSL (build 405)
02:05:36,252 DEBUG [DriverManagerConnectionProvider] returning connection to pool, pool size: 1
02:05:36,277 INFO  [Dialect] Using dialect: org.hibernate.dialect.PostgreSQLDialect
02:05:36,284 INFO  [TransactionFactoryFactory] Using default transaction strategy (direct JDBC transactions)
02:05:36,287 INFO  [TransactionManagerLookupFactory] No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
02:05:36,287 INFO  [SettingsFactory] Automatic flush during beforeCompletion(): disabled
02:05:36,287 INFO  [SettingsFactory] Automatic session close at end of transaction: disabled
02:05:36,287 INFO  [SettingsFactory] JDBC batch size: 15
02:05:36,287 INFO  [SettingsFactory] JDBC batch updates for versioned data: disabled
02:05:36,288 INFO  [SettingsFactory] Scrollable result sets: enabled
02:05:36,288 DEBUG [SettingsFactory] Wrap result sets: disabled
02:05:36,288 INFO  [SettingsFactory] JDBC3 getGeneratedKeys(): disabled
02:05:36,288 INFO  [SettingsFactory] Connection release mode: auto
02:05:36,289 INFO  [SettingsFactory] Default batch fetch size: 1
02:05:36,289 INFO  [SettingsFactory] Generate SQL with comments: disabled
02:05:36,289 INFO  [SettingsFactory] Order SQL updates by primary key: disabled
02:05:36,289 INFO  [SettingsFactory] Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
02:05:36,291 INFO  [ASTQueryTranslatorFactory] Using ASTQueryTranslatorFactory
02:05:36,292 INFO  [SettingsFactory] Query language substitutions: {}
02:05:36,292 INFO  [SettingsFactory] Second-level cache: enabled
02:05:36,292 INFO  [SettingsFactory] Query cache: disabled
02:05:36,292 INFO  [SettingsFactory] Cache provider: org.hibernate.cache.EhCacheProvider
02:05:36,295 INFO  [SettingsFactory] Optimize cache for minimal puts: disabled
02:05:36,295 INFO  [SettingsFactory] Structured second-level cache entries: disabled
02:05:36,296 DEBUG [SQLExceptionConverterFactory] Using dialect defined converter
02:05:36,300 INFO  [SettingsFactory] Echoing all SQL to stdout
02:05:36,300 INFO  [SettingsFactory] Statistics: disabled
02:05:36,300 INFO  [SettingsFactory] Deleted entity synthetic identifier rollback: disabled
02:05:36,300 INFO  [SettingsFactory] Default entity-mode: pojo
02:05:36,344 INFO  [SessionFactoryImpl] building session factory
02:05:36,344 DEBUG [SessionFactoryImpl] Session factory constructed with filter configurations : {}
02:05:36,347 DEBUG [SessionFactoryImpl] instantiating session factory with properties: {java.runtime.name=Java(TM) 2 Runtime Environment, Standard Edition, hibernate.connection.password=ewage123, sun.boot.library.path=/usr/java/jdk1.5.0_07/jre/lib/i386, java.vm.version=1.5.0_07-b03, hibernate.connection.username=ewage, 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, user.country=GB, sun.os.patch.level=unknown, java.vm.specification.name=Java Virtual Machine Specification, user.dir=/home/justin/workspace/default/hibernate-test, java.runtime.version=1.5.0_07-b03, java.awt.graphicsenv=sun.awt.X11GraphicsEnvironment, java.endorsed.dirs=/usr/java/jdk1.5.0_07/jre/lib/endorsed, os.arch=i386, java.io.tmpdir=/tmp, line.separator=
, java.vm.specification.vendor=Sun Microsystems Inc., os.name=Linux, sun.jnu.encoding=UTF-8, java.library.path=/usr/java/jdk1.5.0_07/jre/lib/i386/client:/usr/java/jdk1.5.0_07/jre/lib/i386:/usr/java/jdk1.5.0_07/jre/../lib/i386, java.specification.name=Java Platform API Specification, java.class.version=49.0, sun.management.compiler=HotSpot Client Compiler, os.version=2.6.16.21-0.13-smp, user.home=/home/justin, user.timezone=Africa/Johannesburg, java.awt.printerjob=sun.print.PSPrinterJob, file.encoding=UTF-8, java.specification.version=1.5, hibernate.connection.driver_class=org.postgresql.Driver, user.name=justin, java.class.path=/home/justin/workspace/default/hibernate-test/bin:/home/justin/dev/components/hibernate/hibernate-3.2/lib/ant-1.6.5.jar:/home/justin/dev/components/hibernate/hibernate-3.2/lib/ant-antlr-1.6.5.jar:/home/justin/dev/components/hibernate/hibernate-3.2/lib/ant-junit-1.6.5.jar:/home/justin/dev/components/hibernate/hibernate-3.2/lib/ant-launcher-1.6.5.jar:/home/justin/dev/components/hibernate/hibernate-3.2/lib/antlr-2.7.6.jar:/home/justin/dev/components/hibernate/hibernate-3.2/lib/ant-swing-1.6.5.jar:/home/justin/dev/components/hibernate/hibernate-3.2/lib/asm.jar:/home/justin/dev/components/hibernate/hibernate-3.2/lib/asm-attrs.jar:/home/justin/dev/components/hibernate/hibernate-3.2/lib/c3p0-0.9.0.jar:/home/justin/dev/components/hibernate/hibernate-3.2/lib/cglib-2.1.3.jar:/home/justin/dev/components/hibernate/hibernate-3.2/lib/cleanimports.jar:/home/justin/dev/components/hibernate/hibernate-3.2/lib/commons-collections-2.1.1.jar:/home/justin/dev/components/hibernate/hibernate-3.2/lib/commons-logging-1.0.4.jar:/home/justin/dev/components/hibernate/hibernate-3.2/lib/concurrent-1.3.2.jar:/home/justin/dev/components/hibernate/hibernate-3.2/lib/connector.jar:/home/justin/dev/components/hibernate/hibernate-3.2/lib/dom4j-1.6.1.jar:/home/justin/dev/components/hibernate/hibernate-3.2/lib/ehcache-1.2.jar:/home/justin/dev/components/hibernate/hibernate-3.2/lib/jaas.jar:/home/justin/dev/components/hibernate/hibernate-3.2/lib/jacc-1_0-fr.jar:/home/justin/dev/components/hibernate/hibernate-3.2/lib/javassist.jar:/home/justin/dev/components/hibernate/hibernate-3.2/lib/jaxen-1.1-beta-7.jar:/home/justin/dev/components/hibernate/hibernate-3.2/lib/jboss-cache.jar:/home/justin/dev/components/hibernate/hibernate-3.2/lib/jboss-common.jar:/home/justin/dev/components/hibernate/hibernate-3.2/lib/jboss-jmx.jar:/home/justin/dev/components/hibernate/hibernate-3.2/lib/jboss-system.jar:/home/justin/dev/components/hibernate/hibernate-3.2/lib/jdbc2_0-stdext.jar:/home/justin/dev/components/hibernate/hibernate-3.2/lib/jgroups-2.2.8.jar:/home/justin/dev/components/hibernate/hibernate-3.2/lib/jta.jar:/home/justin/dev/components/hibernate/hibernate-3.2/lib/junit-3.8.1.jar:/home/justin/dev/components/hibernate/hibernate-3.2/lib/log4j-1.2.11.jar:/home/justin/dev/components/hibernate/hibernate-3.2/lib/oscache-2.1.jar:/home/justin/dev/components/hibernate/hibernate-3.2/lib/proxool-0.8.3.jar:/home/justin/dev/components/hibernate/hibernate-3.2/lib/swarmcache-1.0rc2.jar:/home/justin/dev/components/hibernate/hibernate-3.2/lib/syndiag2.jar:/home/justin/dev/components/hibernate/hibernate-3.2/lib/versioncheck.jar:/home/justin/dev/components/hibernate/hibernate-3.2/lib/xerces-2.6.2.jar:/home/justin/dev/components/hibernate/hibernate-3.2/lib/xml-apis.jar:/home/justin/dev/components/hibernate/hibernate-3.2/hibernate3.jar:/home/justin/dev/servers/jboss/jboss-4.0.4.GA-JEMS/server/default/lib/postgresql-8.1-405.jdbc3.jar, hibernate.bytecode.use_reflection_optimizer=false, hibernate.show_sql=true, java.vm.specification.version=1.0, sun.arch.data.model=32, java.home=/usr/java/jdk1.5.0_07/jre, hibernate.connection.url=jdbc:postgresql:ewage, hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect, java.specification.vendor=Sun Microsystems Inc., user.language=en, java.vm.info=mixed mode, sharing, java.version=1.5.0_07, java.ext.dirs=/usr/java/jdk1.5.0_07/jre/lib/ext, sun.boot.class.path=/usr/java/jdk1.5.0_07/jre/lib/rt.jar:/usr/java/jdk1.5.0_07/jre/lib/i18n.jar:/usr/java/jdk1.5.0_07/jre/lib/sunrsasign.jar:/usr/java/jdk1.5.0_07/jre/lib/jsse.jar:/usr/java/jdk1.5.0_07/jre/lib/jce.jar:/usr/java/jdk1.5.0_07/jre/lib/charsets.jar:/usr/java/jdk1.5.0_07/jre/classes, java.vendor=Sun Microsystems Inc., file.separator=/, java.vendor.url.bug=http://java.sun.com/cgi-bin/bugreport.cgi, sun.cpu.endian=little, sun.io.unicode.encoding=UnicodeLittle, sun.cpu.isalist=}
02:05:36,351 DEBUG [CacheManager] Configuring ehcache from classpath.
02:05:36,357 WARN  [ConfigurationFactory] No configuration found. Configuring ehcache from ehcache-failsafe.xml  found in the classpath: jar:file:/home/justin/dev/components/hibernate/hibernate-3.2/lib/ehcache-1.2.jar!/ehcache-failsafe.xml
02:05:36,357 DEBUG [ConfigurationFactory] Configuring ehcache from URL: jar:file:/home/justin/dev/components/hibernate/hibernate-3.2/lib/ehcache-1.2.jar!/ehcache-failsafe.xml
02:05:36,357 DEBUG [ConfigurationFactory] Configuring ehcache from InputStream
02:05:36,364 DEBUG [DiskStoreConfiguration] Disk Store Path: /tmp
02:05:36,372 DEBUG [ConfigurationHelper] No CacheManagerEventListenerFactory class specified. Skipping...
02:05:36,372 DEBUG [ConfigurationHelper] No CachePeerListenerFactoryConfiguration specified. Not configuring a CacheManagerPeerListener.
02:05:36,372 DEBUG [ConfigurationHelper] No CachePeerProviderFactoryConfiguration specified. Not configuring a CacheManagerPeerProvider.
02:05:36,706 DEBUG [AbstractEntityPersister] Static SQL for entity: com.sadalbari.test.Left
02:05:36,707 DEBUG [AbstractEntityPersister]  Version select: select id from left_table where id =?
02:05:36,707 DEBUG [AbstractEntityPersister]  Snapshot select: select left_.id from left_table left_ where left_.id=?
02:05:36,707 DEBUG [AbstractEntityPersister]  Insert 0: insert into left_table (id) values (?)
02:05:36,707 DEBUG [AbstractEntityPersister]  Update 0: null
02:05:36,707 DEBUG [AbstractEntityPersister]  Delete 0: delete from left_table where id=?
02:05:36,715 DEBUG [AbstractEntityPersister] Static SQL for entity: com.sadalbari.test.Right
02:05:36,716 DEBUG [AbstractEntityPersister]  Version select: select id from right_table where id =?
02:05:36,716 DEBUG [AbstractEntityPersister]  Snapshot select: select right_.id from right_table right_ where right_.id=?
02:05:36,716 DEBUG [AbstractEntityPersister]  Insert 0: insert into right_table (id) values (?)
02:05:36,716 DEBUG [AbstractEntityPersister]  Update 0: null
02:05:36,716 DEBUG [AbstractEntityPersister]  Delete 0: delete from right_table where id=?
02:05:36,729 DEBUG [AbstractEntityPersister] Static SQL for entity: com.sadalbari.test.Middle
02:05:36,729 DEBUG [AbstractEntityPersister]  Version select: select id from middle_table where id =?
02:05:36,729 DEBUG [AbstractEntityPersister]  Snapshot select: select middle_.id, middle_.left_id as left2_1_, middle_.right_id as right3_1_ from middle_table middle_ where middle_.id=?
02:05:36,729 DEBUG [AbstractEntityPersister]  Insert 0: insert into middle_table (left_id, right_id, id) values (?, ?, ?)
02:05:36,729 DEBUG [AbstractEntityPersister]  Update 0: update middle_table set left_id=?, right_id=? where id=?
02:05:36,729 DEBUG [AbstractEntityPersister]  Delete 0: delete from middle_table where id=?
02:05:36,738 DEBUG [AbstractCollectionPersister] Static SQL for collection: com.sadalbari.test.Left.middles
02:05:36,738 DEBUG [AbstractCollectionPersister]  Row insert: update middle_table set left_id=? where id=?
02:05:36,738 DEBUG [AbstractCollectionPersister]  Row delete: update middle_table set left_id=null where left_id=? and id=?
02:05:36,738 DEBUG [AbstractCollectionPersister]  One-shot delete: update middle_table set left_id=null where left_id=?
02:05:36,739 DEBUG [AbstractCollectionPersister] Static SQL for collection: com.sadalbari.test.Right.middles
02:05:36,739 DEBUG [AbstractCollectionPersister]  Row insert: update middle_table set right_id=? where id=?
02:05:36,739 DEBUG [AbstractCollectionPersister]  Row delete: update middle_table set right_id=null where right_id=? and id=?
02:05:36,739 DEBUG [AbstractCollectionPersister]  One-shot delete: update middle_table set right_id=null where right_id=?
02:05:36,766 DEBUG [EntityLoader] Static select for entity com.sadalbari.test.Left: select left0_.id as id0_0_ from left_table left0_ where left0_.id=?
02:05:36,767 DEBUG [EntityLoader] Static select for entity com.sadalbari.test.Left: select left0_.id as id0_0_ from left_table left0_ where left0_.id=?
02:05:36,767 DEBUG [EntityLoader] Static select for entity com.sadalbari.test.Left: select left0_.id as id0_0_ from left_table left0_ where left0_.id=? for update
02:05:36,767 DEBUG [EntityLoader] Static select for entity com.sadalbari.test.Left: select left0_.id as id0_0_ from left_table left0_ where left0_.id=? for update
02:05:36,782 DEBUG [EntityLoader] Static select for action ACTION_MERGE on entity com.sadalbari.test.Left: select left0_.id as id0_1_, middles1_.left_id as left2_3_, middles1_.id as id3_, middles1_.id as id1_0_, middles1_.left_id as left2_1_0_, middles1_.right_id as right3_1_0_ from left_table left0_ left outer join middle_table middles1_ on left0_.id=middles1_.left_id where left0_.id=?
02:05:36,783 DEBUG [EntityLoader] Static select for action ACTION_REFRESH on entity com.sadalbari.test.Left: select left0_.id as id0_1_, middles1_.left_id as left2_3_, middles1_.id as id3_, middles1_.id as id1_0_, middles1_.left_id as left2_1_0_, middles1_.right_id as right3_1_0_ from left_table left0_ left outer join middle_table middles1_ on left0_.id=middles1_.left_id where left0_.id=?
02:05:36,783 DEBUG [EntityLoader] Static select for entity com.sadalbari.test.Right: select right0_.id as id2_0_ from right_table right0_ where right0_.id=?
02:05:36,783 DEBUG [EntityLoader] Static select for entity com.sadalbari.test.Right: select right0_.id as id2_0_ from right_table right0_ where right0_.id=?
02:05:36,783 DEBUG [EntityLoader] Static select for entity com.sadalbari.test.Right: select right0_.id as id2_0_ from right_table right0_ where right0_.id=? for update
02:05:36,783 DEBUG [EntityLoader] Static select for entity com.sadalbari.test.Right: select right0_.id as id2_0_ from right_table right0_ where right0_.id=? for update
02:05:36,783 DEBUG [EntityLoader] Static select for action ACTION_MERGE on entity com.sadalbari.test.Right: select right0_.id as id2_0_ from right_table right0_ where right0_.id=?
02:05:36,784 DEBUG [EntityLoader] Static select for action ACTION_REFRESH on entity com.sadalbari.test.Right: select right0_.id as id2_0_ from right_table right0_ where right0_.id=?
02:05:36,784 DEBUG [EntityLoader] Static select for entity com.sadalbari.test.Middle: select middle0_.id as id1_0_, middle0_.left_id as left2_1_0_, middle0_.right_id as right3_1_0_ from middle_table middle0_ where middle0_.id=?
02:05:36,786 DEBUG [EntityLoader] Static select for entity com.sadalbari.test.Middle: select middle0_.id as id1_0_, middle0_.left_id as left2_1_0_, middle0_.right_id as right3_1_0_ from middle_table middle0_ where middle0_.id=?
02:05:36,786 DEBUG [EntityLoader] Static select for entity com.sadalbari.test.Middle: select middle0_.id as id1_0_, middle0_.left_id as left2_1_0_, middle0_.right_id as right3_1_0_ from middle_table middle0_ where middle0_.id=? for update
02:05:36,786 DEBUG [EntityLoader] Static select for entity com.sadalbari.test.Middle: select middle0_.id as id1_0_, middle0_.left_id as left2_1_0_, middle0_.right_id as right3_1_0_ from middle_table middle0_ where middle0_.id=? for update
02:05:36,786 DEBUG [EntityLoader] Static select for action ACTION_MERGE on entity com.sadalbari.test.Middle: select middle0_.id as id1_0_, middle0_.left_id as left2_1_0_, middle0_.right_id as right3_1_0_ from middle_table middle0_ where middle0_.id=?
02:05:36,786 DEBUG [EntityLoader] Static select for action ACTION_REFRESH on entity com.sadalbari.test.Middle: select middle0_.id as id1_0_, middle0_.left_id as left2_1_0_, middle0_.right_id as right3_1_0_ from middle_table middle0_ where middle0_.id=?
02:05:36,791 DEBUG [OneToManyLoader] Static select for one-to-many com.sadalbari.test.Left.middles: select middles0_.left_id as left2_1_, middles0_.id as id1_, middles0_.id as id1_0_, middles0_.left_id as left2_1_0_, middles0_.right_id as right3_1_0_ from middle_table middles0_ where middles0_.left_id=?
02:05:36,792 DEBUG [OneToManyLoader] Static select for one-to-many com.sadalbari.test.Right.middles: select middles0_.right_id as right3_1_, middles0_.id as id1_, middles0_.id as id1_0_, middles0_.left_id as left2_1_0_, middles0_.right_id as right3_1_0_ from middle_table middles0_ where middles0_.right_id=?
02:05:36,794 DEBUG [SessionFactoryObjectFactory] initializing class SessionFactoryObjectFactory
02:05:36,797 DEBUG [SessionFactoryObjectFactory] registered: ff8080820dd2d76d010dd2d76f980000 (unnamed)
02:05:36,797 INFO  [SessionFactoryObjectFactory] Not binding factory to JNDI, no JNDI name configured
02:05:36,797 DEBUG [SessionFactoryImpl] instantiated session factory
02:05:36,797 DEBUG [SessionFactoryImpl] Checking 0 named HQL queries
02:05:36,797 DEBUG [SessionFactoryImpl] Checking 0 named SQL queries
02:05:36,852 DEBUG [SessionImpl] opened session at timestamp: 4746786966728704
02:05:36,854 DEBUG [JDBCTransaction] begin
02:05:36,854 DEBUG [ConnectionManager] opening JDBC connection
02:05:36,854 DEBUG [DriverManagerConnectionProvider] total checked-out connections: 0
02:05:36,854 DEBUG [DriverManagerConnectionProvider] using pooled JDBC connection, pool size: 0
02:05:36,854 DEBUG [JDBCTransaction] current autocommit status: false
02:05:36,854 DEBUG [JDBCContext] after transaction begin
02:05:36,858 DEBUG [DefaultSaveOrUpdateEventListener] saving transient instance
02:05:36,859 DEBUG [AbstractBatcher] about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
02:05:36,859 DEBUG [SQL] select nextval ('hibernate_sequence')
Hibernate: select nextval ('hibernate_sequence')
02:05:36,859 DEBUG [AbstractBatcher] preparing statement
02:05:36,862 DEBUG [SequenceGenerator] Sequence identifier generated: 18
02:05:36,862 DEBUG [AbstractBatcher] about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
02:05:36,862 DEBUG [AbstractBatcher] closing statement
02:05:36,862 DEBUG [AbstractSaveEventListener] generated identifier: 18, using strategy: org.hibernate.id.SequenceGenerator
02:05:36,864 DEBUG [AbstractSaveEventListener] saving [com.sadalbari.test.Left#18]
02:05:36,870 DEBUG [Cascade] processing cascade ACTION_SAVE_UPDATE for: com.sadalbari.test.Left
02:05:36,870 DEBUG [Cascade] done processing cascade ACTION_SAVE_UPDATE for: com.sadalbari.test.Left
02:05:36,880 DEBUG [WrapVisitor] Wrapped collection in role: com.sadalbari.test.Left.middles
02:05:36,888 DEBUG [Cascade] processing cascade ACTION_SAVE_UPDATE for: com.sadalbari.test.Left
02:05:36,889 DEBUG [Cascade] cascade ACTION_SAVE_UPDATE for collection: com.sadalbari.test.Left.middles
02:05:36,889 DEBUG [Cascade] done cascade ACTION_SAVE_UPDATE for collection: com.sadalbari.test.Left.middles
02:05:36,890 DEBUG [Cascade] deleting orphans for collection: com.sadalbari.test.Left.middles
02:05:36,890 DEBUG [Cascade] done deleting orphans for collection: com.sadalbari.test.Left.middles
02:05:36,890 DEBUG [Cascade] done processing cascade ACTION_SAVE_UPDATE for: com.sadalbari.test.Left
02:05:36,890 DEBUG [DefaultSaveOrUpdateEventListener] saving transient instance
02:05:36,890 DEBUG [AbstractBatcher] about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
02:05:36,891 DEBUG [SQL] select nextval ('hibernate_sequence')
Hibernate: select nextval ('hibernate_sequence')
02:05:36,891 DEBUG [AbstractBatcher] preparing statement
02:05:36,891 DEBUG [SequenceGenerator] Sequence identifier generated: 19
02:05:36,891 DEBUG [AbstractBatcher] about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
02:05:36,891 DEBUG [AbstractBatcher] closing statement
02:05:36,891 DEBUG [AbstractSaveEventListener] generated identifier: 19, using strategy: org.hibernate.id.SequenceGenerator
02:05:36,891 DEBUG [AbstractSaveEventListener] saving [com.sadalbari.test.Right#19]
02:05:36,892 DEBUG [Cascade] processing cascade ACTION_SAVE_UPDATE for: com.sadalbari.test.Right
02:05:36,892 DEBUG [Cascade] done processing cascade ACTION_SAVE_UPDATE for: com.sadalbari.test.Right
02:05:36,892 DEBUG [WrapVisitor] Wrapped collection in role: com.sadalbari.test.Right.middles
02:05:36,892 DEBUG [Cascade] processing cascade ACTION_SAVE_UPDATE for: com.sadalbari.test.Right
02:05:36,892 DEBUG [Cascade] deleting orphans for collection: com.sadalbari.test.Right.middles
02:05:36,892 DEBUG [Cascade] done deleting orphans for collection: com.sadalbari.test.Right.middles
02:05:36,892 DEBUG [Cascade] done processing cascade ACTION_SAVE_UPDATE for: com.sadalbari.test.Right
02:05:36,892 DEBUG [JDBCTransaction] commit
02:05:36,892 DEBUG [SessionImpl] automatically flushing session
02:05:36,892 DEBUG [AbstractFlushingEventListener] flushing session
02:05:36,893 DEBUG [AbstractFlushingEventListener] processing flush-time cascades
02:05:36,894 DEBUG [Cascade] processing cascade ACTION_SAVE_UPDATE for: com.sadalbari.test.Left
02:05:36,894 DEBUG [Cascade] cascade ACTION_SAVE_UPDATE for collection: com.sadalbari.test.Left.middles
02:05:36,894 DEBUG [CascadingAction] cascading to saveOrUpdate: com.sadalbari.test.Middle
02:05:36,895 DEBUG [AbstractSaveEventListener] transient instance of: com.sadalbari.test.Middle
02:05:36,895 DEBUG [DefaultSaveOrUpdateEventListener] saving transient instance
02:05:36,895 DEBUG [AbstractBatcher] about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
02:05:36,895 DEBUG [SQL] select nextval ('hibernate_sequence')
Hibernate: select nextval ('hibernate_sequence')
02:05:36,898 DEBUG [AbstractBatcher] preparing statement
02:05:36,898 DEBUG [SequenceGenerator] Sequence identifier generated: 20
02:05:36,898 DEBUG [AbstractBatcher] about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
02:05:36,898 DEBUG [AbstractBatcher] closing statement
02:05:36,898 DEBUG [AbstractSaveEventListener] generated identifier: 20, using strategy: org.hibernate.id.SequenceGenerator
02:05:36,898 DEBUG [AbstractSaveEventListener] saving [com.sadalbari.test.Middle#20]
02:05:36,900 DEBUG [Cascade] done cascade ACTION_SAVE_UPDATE for collection: com.sadalbari.test.Left.middles
02:05:36,900 DEBUG [Cascade] deleting orphans for collection: com.sadalbari.test.Left.middles
02:05:36,901 DEBUG [Cascade] done deleting orphans for collection: com.sadalbari.test.Left.middles
02:05:36,901 DEBUG [Cascade] done processing cascade ACTION_SAVE_UPDATE for: com.sadalbari.test.Left
02:05:36,901 DEBUG [Cascade] processing cascade ACTION_SAVE_UPDATE for: com.sadalbari.test.Right
02:05:36,901 DEBUG [Cascade] deleting orphans for collection: com.sadalbari.test.Right.middles
02:05:36,901 DEBUG [Cascade] done deleting orphans for collection: com.sadalbari.test.Right.middles
02:05:36,901 DEBUG [Cascade] done processing cascade ACTION_SAVE_UPDATE for: com.sadalbari.test.Right
02:05:36,901 DEBUG [AbstractFlushingEventListener] dirty checking collections
02:05:36,901 DEBUG [AbstractFlushingEventListener] Flushing entities and processing referenced collections
02:05:36,905 DEBUG [Collections] Collection found: [com.sadalbari.test.Left.middles#18], was: [<unreferenced>] (initialized)
02:05:36,906 DEBUG [Collections] Collection found: [com.sadalbari.test.Right.middles#19], was: [<unreferenced>] (initialized)
02:05:36,906 DEBUG [AbstractFlushingEventListener] Processing unreferenced collections
02:05:36,906 DEBUG [AbstractFlushingEventListener] Scheduling collection removes/(re)creates/updates
02:05:36,908 DEBUG [AbstractFlushingEventListener] Flushed: 3 insertions, 0 updates, 0 deletions to 3 objects
02:05:36,908 DEBUG [AbstractFlushingEventListener] Flushed: 2 (re)creations, 0 updates, 0 removals to 2 collections
02:05:36,909 DEBUG [Printer] listing entities:
02:05:36,909 DEBUG [Printer] com.sadalbari.test.Middle{Right=com.sadalbari.test.Right#19, left=com.sadalbari.test.Left#18, id=20}
02:05:36,910 DEBUG [Printer] com.sadalbari.test.Right{id=19, middles=[com.sadalbari.test.Middle#20]}
02:05:36,910 DEBUG [Printer] com.sadalbari.test.Left{id=18, middles=[com.sadalbari.test.Middle#20]}
02:05:36,910 DEBUG [AbstractFlushingEventListener] executing flush
02:05:36,910 DEBUG [ConnectionManager] registering flush begin
02:05:36,910 DEBUG [AbstractEntityPersister] Inserting entity: [com.sadalbari.test.Left#18]
02:05:36,910 DEBUG [AbstractBatcher] about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
02:05:36,910 DEBUG [SQL] insert into left_table (id) values (?)
Hibernate: insert into left_table (id) values (?)
02:05:36,910 DEBUG [AbstractBatcher] preparing statement
02:05:36,910 DEBUG [AbstractEntityPersister] Dehydrating entity: [com.sadalbari.test.Left#18]
02:05:36,910 DEBUG [LongType] binding '18' to parameter: 1
02:05:36,910 DEBUG [AbstractBatcher] Adding to batch
02:05:36,911 DEBUG [AbstractEntityPersister] Inserting entity: [com.sadalbari.test.Right#19]
02:05:36,911 DEBUG [AbstractBatcher] Executing batch size: 1
02:05:36,920 DEBUG [AbstractBatcher] about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
02:05:36,920 DEBUG [AbstractBatcher] closing statement
02:05:36,923 DEBUG [JDBCExceptionReporter] Could not execute JDBC batch update [insert into left_table (id) values (?)]
java.sql.BatchUpdateException: Batch entry 0 insert into left_table (id) values (18) was aborted.  Call getNextException to see the cause.
   at org.postgresql.jdbc2.AbstractJdbc2Statement$BatchResultHandler.handleError(AbstractJdbc2Statement.java:2497)
   at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1298)
   at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:347)
   at org.postgresql.jdbc2.AbstractJdbc2Statement.executeBatch(AbstractJdbc2Statement.java:2559)
   at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:58)
   at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:242)
   at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:92)
   at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:87)
   at org.hibernate.jdbc.AbstractBatcher.prepareBatchStatement(AbstractBatcher.java:218)
   at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2106)
   at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2503)
   at org.hibernate.action.EntityInsertAction.execute(EntityInsertAction.java:51)
   at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:248)
   at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:232)
   at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:139)
   at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:297)
   at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
   at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:993)
   at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:340)
   at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)
   at com.sadalbari.test.Test.main(Test.java:42)
02:05:36,925 WARN  [JDBCExceptionReporter] SQL Error: 0, SQLState: null
02:05:36,925 ERROR [JDBCExceptionReporter] Batch entry 0 insert into left_table (id) values (18) was aborted.  Call getNextException to see the cause.
02:05:36,925 WARN  [JDBCExceptionReporter] SQL Error: 0, SQLState: 23505
02:05:36,925 ERROR [JDBCExceptionReporter] ERROR: duplicate key violates unique constraint "left_table_pkey"
02:05:36,927 ERROR [AbstractFlushingEventListener] Could not synchronize database state with session
org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update
   at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:71)
   at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
   at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:249)
   at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:92)
   at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:87)
   at org.hibernate.jdbc.AbstractBatcher.prepareBatchStatement(AbstractBatcher.java:218)
   at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2106)
   at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2503)
   at org.hibernate.action.EntityInsertAction.execute(EntityInsertAction.java:51)
   at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:248)
   at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:232)
   at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:139)
   at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:297)
   at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
   at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:993)
   at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:340)
   at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)
   at com.sadalbari.test.Test.main(Test.java:42)
Caused by: java.sql.BatchUpdateException: Batch entry 0 insert into left_table (id) values (18) was aborted.  Call getNextException to see the cause.
   at org.postgresql.jdbc2.AbstractJdbc2Statement$BatchResultHandler.handleError(AbstractJdbc2Statement.java:2497)
   at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1298)
   at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:347)
   at org.postgresql.jdbc2.AbstractJdbc2Statement.executeBatch(AbstractJdbc2Statement.java:2559)
   at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:58)
   at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:242)
   ... 15 more
02:05:36,932 DEBUG [ConnectionManager] registering flush end
Exception in thread "main" org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update
   at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:71)
   at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
   at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:249)
   at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:92)
   at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:87)
   at org.hibernate.jdbc.AbstractBatcher.prepareBatchStatement(AbstractBatcher.java:218)
   at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2106)
   at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2503)
   at org.hibernate.action.EntityInsertAction.execute(EntityInsertAction.java:51)
   at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:248)
   at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:232)
   at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:139)
   at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:297)
   at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
   at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:993)
   at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:340)
   at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)
   at com.sadalbari.test.Test.main(Test.java:42)
Caused by: java.sql.BatchUpdateException: Batch entry 0 insert into left_table (id) values (18) was aborted.  Call getNextException to see the cause.
   at org.postgresql.jdbc2.AbstractJdbc2Statement$BatchResultHandler.handleError(AbstractJdbc2Statement.java:2497)
   at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1298)
   at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:347)
   at org.postgresql.jdbc2.AbstractJdbc2Statement.executeBatch(AbstractJdbc2Statement.java:2559)
   at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:58)
   at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:242)
   ... 15 more


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.