-->
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.  [ 3 posts ] 
Author Message
 Post subject: NonUniqueObjectException
PostPosted: Thu Oct 27, 2005 6:11 pm 
Newbie

Joined: Tue Oct 18, 2005 8:13 pm
Posts: 4
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:

3.0.5

Mapping documents:

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="gov.mtc.agenda.beans.event.Event"
        table="EVENT"
    >

        <id
            name="ID"
            column="ID"
            type="long"
            unsaved-value="null"
        >
            <generator class="native">
              <!-- 
                  To add non XDoclet generator parameters, create a file named
                  hibernate-generator-params-Event.xml
                  containing the additional parameters and place it in your merge dir.
              -->
            </generator>
        </id>

        <property
            name="name"
            type="java.lang.String"
            update="true"
            insert="true"
            column="name"
            length="255"
        />

        <property
            name="notes"
            type="java.lang.String"
            update="true"
            insert="true"
            column="notes"
            length="4000"
        />

        <property
            name="eventDate"
            type="java.sql.Date"
            update="true"
            insert="true"
            column="eventDate"
        />

        <property
            name="timeComment"
            type="java.lang.String"
            update="true"
            insert="true"
            column="timeComment"
            length="4000"
        />

        <property
            name="endtime"
            type="java.sql.Date"
            update="true"
            insert="true"
            column="endtime"
        />

        <property
            name="nextMeetingDate"
            type="java.sql.Date"
            update="true"
            insert="true"
            column="nextMeetingDate"
        />

        <many-to-one
            name="committee"
            class="gov.mtc.agenda.beans.event.Committee"
            cascade="none"
            outer-join="auto"
            update="true"
            insert="true"
            column="COMMITTEE_ID"
            not-null="true"
        />

        <property
            name="revisedagenda"
            type="boolean"
            update="true"
            insert="true"
            column="revisedagenda"
        />

        <property
            name="audiocast"
            type="boolean"
            update="true"
            insert="true"
            column="audiocast"
        />

        <property
            name="hide"
            type="boolean"
            update="true"
            insert="true"
            column="hide"
        />

        <property
            name="modified"
            type="java.sql.Date"
            update="true"
            insert="true"
            column="modified"
        />

        <property
            name="audiocastmarker"
            type="java.lang.String"
            update="true"
            insert="true"
            column="audiocastmarker"
            length="255"
        />

        <!--
            To add non XDoclet property mappings, create a file named
                hibernate-properties-Event.xml
            containing the additional properties and place it in your merge dir.
        -->

    </class>

</hibernate-mapping>


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="gov.mtc.agenda.beans.event.Committee"
        table="COMMITTEE"
    >

        <id
            name="ID"
            column="ID"
            type="long"
            unsaved-value="null"
        >
            <generator class="native">
              <!-- 
                  To add non XDoclet generator parameters, create a file named
                  hibernate-generator-params-Committee.xml
                  containing the additional parameters and place it in your merge dir.
              -->
            </generator>
        </id>

        <property
            name="name"
            type="java.lang.String"
            update="true"
            insert="true"
            column="name"
            length="255"
        />

        <property
            name="description"
            type="java.lang.String"
            update="true"
            insert="true"
            column="description"
            length="4000"
        />

        <set
            name="events"
            lazy="false"
            inverse="true"
            cascade="all-delete-orphan"
            sort="unsorted"
        >

            <key
                column="COMMITTEE_ID"
            >
            </key>

            <one-to-many
                  class="gov.mtc.agenda.beans.event.Event"
            />

        </set>

        <!--
            To add non XDoclet property mappings, create a file named
                hibernate-properties-Committee.xml
            containing the additional properties and place it in your merge dir.
        -->

    </class>

</hibernate-mapping>


Code between sessionFactory.openSession() and session.close():

Code:
    private static void processLegacyCommittee(LegacyCommittee legacyCommittee)
            throws SQLException
    {
        Committee committee = new Committee();
        committee.setName(legacyCommittee.getName());
        committee.setDescription(legacyCommittee.getDescription());
        Vector legacyAgendas = legacyCommittee.getAgendas();
        for (int i = 0; i < legacyAgendas.size(); i++)
        {
            Event e = assembleNewEvent
                    ((LegacyAgenda) legacyAgendas.get(i),
                     committee.getName());
            committee.addEvent(e);
            e.setCommittee(committee);
        }

        Session session = HibernateUtil.currentSession();
        Transaction tx = session.beginTransaction();

        session.save(committee);

        tx.commit();
        HibernateUtil.closeSession();
    }


Full stack trace of any exception that occurs:

Code:
Exception in thread "main" org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session: [gov.mtc.agenda.beans.event.Event#0]
   at org.hibernate.engine.PersistenceContext.checkUniqueness(PersistenceContext.java:586)
   at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performUpdate(DefaultSaveOrUpdateEventListener.java:254)
   at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsDetached(DefaultSaveOrUpdateEventListener.java:214)
   at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:91)
   at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:69)
   at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:468)
   at org.hibernate.engine.Cascades$5.cascade(Cascades.java:154)
   at org.hibernate.engine.Cascades.cascadeAssociation(Cascades.java:771)
   at org.hibernate.engine.Cascades.cascade(Cascades.java:720)
   at org.hibernate.engine.Cascades.cascadeCollection(Cascades.java:895)
   at org.hibernate.engine.Cascades.cascadeAssociation(Cascades.java:792)
   at org.hibernate.engine.Cascades.cascade(Cascades.java:720)
   at org.hibernate.engine.Cascades.cascade(Cascades.java:847)
   at org.hibernate.event.def.AbstractSaveEventListener.cascadeAfterSave(AbstractSaveEventListener.java:363)
   at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:265)
   at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:160)
   at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:108)
   at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:184)
   at org.hibernate.event.def.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:33)
   at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:173)
   at org.hibernate.event.def.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:27)
   at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:69)
   at org.hibernate.impl.SessionImpl.save(SessionImpl.java:481)
   at org.hibernate.impl.SessionImpl.save(SessionImpl.java:476)
   at gov.mtc.agenda.legacydata.Main.processLegacyCommittee(Main.java:96)
   at gov.mtc.agenda.legacydata.Main.main(Main.java:45)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:585)
   at com.intellij.rt.execution.application.AppMain.main(AppMain.java:86)


Name and version of the database you are using:

Oracle 9i

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:

Code:
14:49:47,890  INFO Environment:464 - Hibernate 3.0.5
14:49:47,890  INFO Environment:477 - hibernate.properties not found
14:49:47,890  INFO Environment:510 - using CGLIB reflection optimizer
14:49:47,890  INFO Environment:540 - using JDK 1.4 java.sql.Timestamp handling
14:49:47,968  INFO Configuration:1110 - configuring from resource: /hibernate.cfg.xml
14:49:47,968  INFO Configuration:1081 - Configuration resource: /hibernate.cfg.xml
14:49:48,265 DEBUG DTDEntityResolver:42 - trying to locate http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd in classpath under org/hibernate/
14:49:48,265 DEBUG DTDEntityResolver:53 - found http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd in classpath
14:49:48,312 DEBUG Configuration:1067 - dialect=org.hibernate.dialect.Oracle9Dialect
14:49:48,312 DEBUG Configuration:1067 - connection.driver_class=oracle.jdbc.driver.OracleDriver
14:49:48,312 DEBUG Configuration:1067 - connection.url=jdbc:oracle:thin:@localhost:1521:WORKDB
14:49:48,312 DEBUG Configuration:1067 - connection.username=agendahibernate
14:49:48,312 DEBUG Configuration:1067 - connection.password=*****
14:49:48,312 DEBUG Configuration:1067 - show_sql=true
14:49:48,312 DEBUG Configuration:1067 - hbm2ddl.auto=create
14:49:48,312 DEBUG Configuration:1067 - connection.shutdown=true
14:49:48,312 DEBUG Configuration:1262 - null<-org.dom4j.tree.DefaultAttribute@4aa0ce [Attribute: name resource value "mappings\gov\mtc\agenda\beans\person\Person.hbm.xml"]
14:49:48,312  INFO Configuration:444 - Mapping resource: mappings\gov\mtc\agenda\beans\person\Person.hbm.xml
14:49:48,328 DEBUG DTDEntityResolver:42 - trying to locate http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd in classpath under org/hibernate/
14:49:48,328 DEBUG DTDEntityResolver:53 - found http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd in classpath
14:49:48,484  INFO HbmBinder:260 - Mapping class: gov.mtc.agenda.beans.person.Person -> PERSON
14:49:48,484 DEBUG HbmBinder:1099 - Mapped property: ID -> ID
14:49:48,500 DEBUG HbmBinder:1099 - Mapped property: honorific -> honorific
14:49:48,500 DEBUG HbmBinder:1099 - Mapped property: firstName -> firstName
14:49:48,500 DEBUG HbmBinder:1099 - Mapped property: middleName -> middleName
14:49:48,500 DEBUG HbmBinder:1099 - Mapped property: lastName -> lastName
14:49:48,500 DEBUG HbmBinder:1099 - Mapped property: email -> email
14:49:48,500 DEBUG HbmBinder:1099 - Mapped property: phone -> phone
14:49:48,500 DEBUG HbmBinder:1099 - Mapped property: notes -> notes
14:49:48,515 DEBUG HbmBinder:1099 - Mapped property: modified -> modified
14:49:48,515 DEBUG HbmBinder:1099 - Mapped property: represents -> represents
14:49:48,515 DEBUG HbmBinder:1099 - Mapped property: nameSuffix -> nameSuffix
14:49:48,515 DEBUG Configuration:1262 - null<-org.dom4j.tree.DefaultAttribute@9be79a [Attribute: name resource value "mappings\gov\mtc\agenda\beans\event\Committee.hbm.xml"]
14:49:48,515  INFO Configuration:444 - Mapping resource: mappings\gov\mtc\agenda\beans\event\Committee.hbm.xml
14:49:48,515 DEBUG DTDEntityResolver:42 - trying to locate http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd in classpath under org/hibernate/
14:49:48,515 DEBUG DTDEntityResolver:53 - found http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd in classpath
14:49:48,546  INFO HbmBinder:260 - Mapping class: gov.mtc.agenda.beans.event.Committee -> COMMITTEE
14:49:48,546 DEBUG HbmBinder:1099 - Mapped property: ID -> ID
14:49:48,546 DEBUG HbmBinder:1099 - Mapped property: name -> name
14:49:48,546 DEBUG HbmBinder:1099 - Mapped property: description -> description
14:49:48,562 DEBUG HbmBinder:1099 - Mapped property: events
14:49:48,562 DEBUG Configuration:1262 - null<-org.dom4j.tree.DefaultAttribute@ec6b00 [Attribute: name resource value "mappings\gov\mtc\agenda\beans\event\Event.hbm.xml"]
14:49:48,562  INFO Configuration:444 - Mapping resource: mappings\gov\mtc\agenda\beans\event\Event.hbm.xml
14:49:48,562 DEBUG DTDEntityResolver:42 - trying to locate http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd in classpath under org/hibernate/
14:49:48,562 DEBUG DTDEntityResolver:53 - found http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd in classpath
14:49:48,593  INFO HbmBinder:260 - Mapping class: gov.mtc.agenda.beans.event.Event -> EVENT
14:49:48,593 DEBUG HbmBinder:1099 - Mapped property: ID -> ID
14:49:48,593 DEBUG HbmBinder:1099 - Mapped property: name -> name
14:49:48,609 DEBUG HbmBinder:1099 - Mapped property: notes -> notes
14:49:48,609 DEBUG HbmBinder:1099 - Mapped property: eventDate -> eventDate
14:49:48,609 DEBUG HbmBinder:1099 - Mapped property: timeComment -> timeComment
14:49:48,609 DEBUG HbmBinder:1099 - Mapped property: endtime -> endtime
14:49:48,609 DEBUG HbmBinder:1099 - Mapped property: nextMeetingDate -> nextMeetingDate
14:49:48,750 DEBUG HbmBinder:1099 - Mapped property: committee -> COMMITTEE_ID
14:49:48,750 DEBUG HbmBinder:1099 - Mapped property: revisedagenda -> revisedagenda
14:49:48,750 DEBUG HbmBinder:1099 - Mapped property: audiocast -> audiocast
14:49:48,750 DEBUG HbmBinder:1099 - Mapped property: hide -> hide
14:49:48,750 DEBUG HbmBinder:1099 - Mapped property: modified -> modified
14:49:48,750 DEBUG HbmBinder:1099 - Mapped property: audiocastmarker -> audiocastmarker
14:49:48,750  INFO Configuration:1222 - Configured SessionFactory: null
14:49:48,750 DEBUG Configuration:1223 - properties:

[ ... ]

14:49:48,750 DEBUG Configuration:998 - Preparing to build session factory with filters : {}
14:49:48,750  INFO Configuration:875 - processing extends queue
14:49:48,750  INFO Configuration:879 - processing collection mappings
14:49:48,750 DEBUG HbmBinder:2466 - Second pass for collection: gov.mtc.agenda.beans.event.Committee.events
14:49:48,750  INFO HbmBinder:2041 - Mapping collection: gov.mtc.agenda.beans.event.Committee.events -> EVENT
14:49:48,750 DEBUG HbmBinder:2482 - Mapped collection key: COMMITTEE_ID, one-to-many: gov.mtc.agenda.beans.event.Event
14:49:48,750  INFO Configuration:888 - processing association property references
14:49:48,750  INFO Configuration:917 - processing foreign key constraints
14:49:48,750 DEBUG Configuration:964 - resolving reference to class: gov.mtc.agenda.beans.event.Committee
14:49:48,765  INFO DriverManagerConnectionProvider:41 - Using Hibernate built-in connection pool (not for production use!)
14:49:48,765  INFO DriverManagerConnectionProvider:42 - Hibernate connection pool size: 20
14:49:48,765  INFO DriverManagerConnectionProvider:45 - autocommit mode: false
14:49:48,812  INFO DriverManagerConnectionProvider:80 - using driver: oracle.jdbc.driver.OracleDriver at URL: jdbc:oracle:thin:@localhost:1521:WORKDB
14:49:48,812  INFO DriverManagerConnectionProvider:83 - connection properties: {user=agendahibernate, password=*****, shutdown=true}
14:49:48,812 DEBUG DriverManagerConnectionProvider:93 - total checked-out connections: 0
14:49:48,812 DEBUG DriverManagerConnectionProvider:109 - opening new JDBC connection
14:49:49,250 DEBUG DriverManagerConnectionProvider:115 - created connection to: jdbc:oracle:thin:@localhost:1521:WORKDB, Isolation Level: 2
14:49:49,265 DEBUG SettingsFactory:295 - could not get database version from JDBC metadata
14:49:49,265  INFO SettingsFactory:77 - RDBMS: Oracle, version: Oracle9i Release 9.2.0.1.0 - Production
JServer Release 9.2.0.1.0 - Production
14:49:49,265  INFO SettingsFactory:78 - JDBC driver: Oracle JDBC driver, version: 9.2.0.1.0
14:49:49,265 DEBUG DriverManagerConnectionProvider:129 - returning connection to pool, pool size: 1
14:49:49,281  INFO Dialect:92 - Using dialect: org.hibernate.dialect.Oracle9Dialect
14:49:49,296  INFO TransactionFactoryFactory:31 - Using default transaction strategy (direct JDBC transactions)
14:49:49,296  INFO TransactionManagerLookupFactory:33 - No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
14:49:49,296  INFO SettingsFactory:125 - Automatic flush during beforeCompletion(): disabled
14:49:49,296  INFO SettingsFactory:129 - Automatic session close at end of transaction: disabled
14:49:49,296  INFO SettingsFactory:136 - JDBC batch size: 15
14:49:49,296  INFO SettingsFactory:139 - JDBC batch updates for versioned data: disabled
14:49:49,296  INFO SettingsFactory:144 - Scrollable result sets: enabled
14:49:49,296 DEBUG SettingsFactory:148 - Wrap result sets: disabled
14:49:49,296  INFO SettingsFactory:152 - JDBC3 getGeneratedKeys(): disabled
14:49:49,296  INFO SettingsFactory:160 - Connection release mode: null
14:49:49,312  INFO SettingsFactory:187 - Default batch fetch size: 1
14:49:49,312  INFO SettingsFactory:191 - Generate SQL with comments: disabled
14:49:49,312  INFO SettingsFactory:195 - Order SQL updates by primary key: disabled
14:49:49,312  INFO SettingsFactory:334 - Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
14:49:49,312  INFO ASTQueryTranslatorFactory:21 - Using ASTQueryTranslatorFactory
14:49:49,312  INFO SettingsFactory:203 - Query language substitutions: {}
14:49:49,312  INFO SettingsFactory:209 - Second-level cache: enabled
14:49:49,312  INFO SettingsFactory:213 - Query cache: disabled
14:49:49,312  INFO SettingsFactory:321 - Cache provider: org.hibernate.cache.EhCacheProvider
14:49:49,312  INFO SettingsFactory:228 - Optimize cache for minimal puts: disabled
14:49:49,312  INFO SettingsFactory:237 - Structured second-level cache entries: disabled
14:49:49,312 DEBUG SQLExceptionConverterFactory:52 - Using dialect defined converter
14:49:49,328  INFO SettingsFactory:257 - Echoing all SQL to stdout
14:49:49,328  INFO SettingsFactory:261 - Statistics: disabled
14:49:49,328  INFO SettingsFactory:265 - Deleted entity synthetic identifier rollback: disabled
14:49:49,328  INFO SettingsFactory:279 - Default entity-mode: pojo
14:49:49,437  INFO SessionFactoryImpl:152 - building session factory
14:49:49,437 DEBUG SessionFactoryImpl:161 - Session factory constructed with filter configurations : {}
14:49:49,437 DEBUG SessionFactoryImpl:164 - instantiating session factory with properties:

[ ... ]

14:49:49,968 DEBUG ReflectHelper:201 - reflection optimizer disabled for: gov.mtc.agenda.beans.event.Event, NullPointerException: null
14:49:50,000 DEBUG BasicEntityPersister:2220 - Static SQL for entity: gov.mtc.agenda.beans.event.Event
14:49:50,000 DEBUG BasicEntityPersister:2222 -  Version select: select ID from EVENT where ID =?
14:49:50,000 DEBUG BasicEntityPersister:2223 -  Snapshot select: select event_.ID, event_.name as name2_, event_.notes as notes2_, event_.eventDate as eventDate2_, event_.timeComment as timeComm5_2_, event_.endtime as endtime2_, event_.nextMeetingDate as nextMeet7_2_, event_.COMMITTEE_ID as COMMITTEE8_2_, event_.revisedagenda as reviseda9_2_, event_.audiocast as audiocast2_, event_.hide as hide2_, event_.modified as modified2_, event_.audiocastmarker as audioca13_2_ from EVENT event_ where event_.ID=?
14:49:50,000 DEBUG BasicEntityPersister:2225 -  Insert 0: insert into EVENT (name, notes, eventDate, timeComment, endtime, nextMeetingDate, COMMITTEE_ID, revisedagenda, audiocast, hide, modified, audiocastmarker, ID) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
14:49:50,000 DEBUG BasicEntityPersister:2226 -  Update 0: update EVENT set name=?, notes=?, eventDate=?, timeComment=?, endtime=?, nextMeetingDate=?, COMMITTEE_ID=?, revisedagenda=?, audiocast=?, hide=?, modified=?, audiocastmarker=? where ID=?
14:49:50,000 DEBUG BasicEntityPersister:2227 -  Delete 0: delete from EVENT where ID=?
14:49:50,078 DEBUG BasicEntityPersister:2220 - Static SQL for entity: gov.mtc.agenda.beans.person.Person
14:49:50,078 DEBUG BasicEntityPersister:2222 -  Version select: select ID from PERSON where ID =?
14:49:50,078 DEBUG BasicEntityPersister:2223 -  Snapshot select: select person_.ID, person_.honorific as honorific0_, person_.firstName as firstName0_, person_.middleName as middleName0_, person_.lastName as lastName0_, person_.email as email0_, person_.phone as phone0_, person_.notes as notes0_, person_.modified as modified0_, person_.represents as represents0_, person_.nameSuffix as nameSuffix0_ from PERSON person_ where person_.ID=?
14:49:50,078 DEBUG BasicEntityPersister:2225 -  Insert 0: insert into PERSON (honorific, firstName, middleName, lastName, email, phone, notes, modified, represents, nameSuffix, ID) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
14:49:50,078 DEBUG BasicEntityPersister:2226 -  Update 0: update PERSON set honorific=?, firstName=?, middleName=?, lastName=?, email=?, phone=?, notes=?, modified=?, represents=?, nameSuffix=? where ID=?
14:49:50,078 DEBUG BasicEntityPersister:2227 -  Delete 0: delete from PERSON where ID=?
14:49:50,125 DEBUG BasicEntityPersister:2220 - Static SQL for entity: gov.mtc.agenda.beans.event.Committee
14:49:50,125 DEBUG BasicEntityPersister:2222 -  Version select: select ID from COMMITTEE where ID =?
14:49:50,125 DEBUG BasicEntityPersister:2223 -  Snapshot select: select committee_.ID, committee_.name as name1_, committee_.description as descript3_1_ from COMMITTEE committee_ where committee_.ID=?
14:49:50,125 DEBUG BasicEntityPersister:2225 -  Insert 0: insert into COMMITTEE (name, description, ID) values (?, ?, ?)
14:49:50,125 DEBUG BasicEntityPersister:2226 -  Update 0: update COMMITTEE set name=?, description=? where ID=?
14:49:50,125 DEBUG BasicEntityPersister:2227 -  Delete 0: delete from COMMITTEE where ID=?
14:49:50,140 DEBUG AbstractCollectionPersister:479 - Static SQL for collection: gov.mtc.agenda.beans.event.Committee.events
14:49:50,140 DEBUG AbstractCollectionPersister:480 -  Row insert: update EVENT set COMMITTEE_ID=? where ID=?
14:49:50,140 DEBUG AbstractCollectionPersister:482 -  Row delete: update EVENT set COMMITTEE_ID=null where COMMITTEE_ID=? and ID=?
14:49:50,140 DEBUG AbstractCollectionPersister:483 -  One-shot delete: update EVENT set COMMITTEE_ID=null where COMMITTEE_ID=?
14:49:50,156 DEBUG EntityLoader:95 - Static select for entity gov.mtc.agenda.beans.event.Event: select event0_.ID as ID0_, event0_.name as name2_0_, event0_.notes as notes2_0_, event0_.eventDate as eventDate2_0_, event0_.timeComment as timeComm5_2_0_, event0_.endtime as endtime2_0_, event0_.nextMeetingDate as nextMeet7_2_0_, event0_.COMMITTEE_ID as COMMITTEE8_2_0_, event0_.revisedagenda as reviseda9_2_0_, event0_.audiocast as audiocast2_0_, event0_.hide as hide2_0_, event0_.modified as modified2_0_, event0_.audiocastmarker as audioca13_2_0_ from EVENT event0_ where event0_.ID=?
14:49:50,156 DEBUG EntityLoader:95 - Static select for entity gov.mtc.agenda.beans.event.Event: select event0_.ID as ID0_, event0_.name as name2_0_, event0_.notes as notes2_0_, event0_.eventDate as eventDate2_0_, event0_.timeComment as timeComm5_2_0_, event0_.endtime as endtime2_0_, event0_.nextMeetingDate as nextMeet7_2_0_, event0_.COMMITTEE_ID as COMMITTEE8_2_0_, event0_.revisedagenda as reviseda9_2_0_, event0_.audiocast as audiocast2_0_, event0_.hide as hide2_0_, event0_.modified as modified2_0_, event0_.audiocastmarker as audioca13_2_0_ from EVENT event0_ where event0_.ID=?
14:49:50,187 DEBUG EntityLoader:95 - Static select for entity gov.mtc.agenda.beans.event.Event: select event0_.ID as ID0_, event0_.name as name2_0_, event0_.notes as notes2_0_, event0_.eventDate as eventDate2_0_, event0_.timeComment as timeComm5_2_0_, event0_.endtime as endtime2_0_, event0_.nextMeetingDate as nextMeet7_2_0_, event0_.COMMITTEE_ID as COMMITTEE8_2_0_, event0_.revisedagenda as reviseda9_2_0_, event0_.audiocast as audiocast2_0_, event0_.hide as hide2_0_, event0_.modified as modified2_0_, event0_.audiocastmarker as audioca13_2_0_ from EVENT event0_ where event0_.ID=? for update
14:49:50,187 DEBUG EntityLoader:95 - Static select for entity gov.mtc.agenda.beans.event.Event: select event0_.ID as ID0_, event0_.name as name2_0_, event0_.notes as notes2_0_, event0_.eventDate as eventDate2_0_, event0_.timeComment as timeComm5_2_0_, event0_.endtime as endtime2_0_, event0_.nextMeetingDate as nextMeet7_2_0_, event0_.COMMITTEE_ID as COMMITTEE8_2_0_, event0_.revisedagenda as reviseda9_2_0_, event0_.audiocast as audiocast2_0_, event0_.hide as hide2_0_, event0_.modified as modified2_0_, event0_.audiocastmarker as audioca13_2_0_ from EVENT event0_ where event0_.ID=? for update nowait
14:49:50,203 DEBUG EntityLoader:95 - Static select for entity gov.mtc.agenda.beans.person.Person: select person0_.ID as ID0_, person0_.honorific as honorific0_0_, person0_.firstName as firstName0_0_, person0_.middleName as middleName0_0_, person0_.lastName as lastName0_0_, person0_.email as email0_0_, person0_.phone as phone0_0_, person0_.notes as notes0_0_, person0_.modified as modified0_0_, person0_.represents as represents0_0_, person0_.nameSuffix as nameSuffix0_0_ from PERSON person0_ where person0_.ID=?
14:49:50,203 DEBUG EntityLoader:95 - Static select for entity gov.mtc.agenda.beans.person.Person: select person0_.ID as ID0_, person0_.honorific as honorific0_0_, person0_.firstName as firstName0_0_, person0_.middleName as middleName0_0_, person0_.lastName as lastName0_0_, person0_.email as email0_0_, person0_.phone as phone0_0_, person0_.notes as notes0_0_, person0_.modified as modified0_0_, person0_.represents as represents0_0_, person0_.nameSuffix as nameSuffix0_0_ from PERSON person0_ where person0_.ID=?
14:49:50,203 DEBUG EntityLoader:95 - Static select for entity gov.mtc.agenda.beans.person.Person: select person0_.ID as ID0_, person0_.honorific as honorific0_0_, person0_.firstName as firstName0_0_, person0_.middleName as middleName0_0_, person0_.lastName as lastName0_0_, person0_.email as email0_0_, person0_.phone as phone0_0_, person0_.notes as notes0_0_, person0_.modified as modified0_0_, person0_.represents as represents0_0_, person0_.nameSuffix as nameSuffix0_0_ from PERSON person0_ where person0_.ID=? for update
14:49:50,203 DEBUG EntityLoader:95 - Static select for entity gov.mtc.agenda.beans.person.Person: select person0_.ID as ID0_, person0_.honorific as honorific0_0_, person0_.firstName as firstName0_0_, person0_.middleName as middleName0_0_, person0_.lastName as lastName0_0_, person0_.email as email0_0_, person0_.phone as phone0_0_, person0_.notes as notes0_0_, person0_.modified as modified0_0_, person0_.represents as represents0_0_, person0_.nameSuffix as nameSuffix0_0_ from PERSON person0_ where person0_.ID=? for update nowait
14:49:50,203 DEBUG EntityLoader:95 - Static select for entity gov.mtc.agenda.beans.event.Committee: select committee0_.ID as ID0_, committee0_.name as name1_0_, committee0_.description as descript3_1_0_ from COMMITTEE committee0_ where committee0_.ID=?
14:49:50,203 DEBUG EntityLoader:95 - Static select for entity gov.mtc.agenda.beans.event.Committee: select committee0_.ID as ID0_, committee0_.name as name1_0_, committee0_.description as descript3_1_0_ from COMMITTEE committee0_ where committee0_.ID=?
14:49:50,203 DEBUG EntityLoader:95 - Static select for entity gov.mtc.agenda.beans.event.Committee: select committee0_.ID as ID0_, committee0_.name as name1_0_, committee0_.description as descript3_1_0_ from COMMITTEE committee0_ where committee0_.ID=? for update
14:49:50,203 DEBUG EntityLoader:95 - Static select for entity gov.mtc.agenda.beans.event.Committee: select committee0_.ID as ID0_, committee0_.name as name1_0_, committee0_.description as descript3_1_0_ from COMMITTEE committee0_ where committee0_.ID=? for update nowait
14:49:50,203 DEBUG OneToManyLoader:106 - Static select for one-to-many gov.mtc.agenda.beans.event.Committee.events: select events0_.COMMITTEE_ID as COMMITTEE8_1_, events0_.ID as ID1_, events0_.ID as ID0_, events0_.name as name2_0_, events0_.notes as notes2_0_, events0_.eventDate as eventDate2_0_, events0_.timeComment as timeComm5_2_0_, events0_.endtime as endtime2_0_, events0_.nextMeetingDate as nextMeet7_2_0_, events0_.COMMITTEE_ID as COMMITTEE8_2_0_, events0_.revisedagenda as reviseda9_2_0_, events0_.audiocast as audiocast2_0_, events0_.hide as hide2_0_, events0_.modified as modified2_0_, events0_.audiocastmarker as audioca13_2_0_ from EVENT events0_ where events0_.COMMITTEE_ID=?
14:49:50,234 DEBUG SessionFactoryObjectFactory:39 - initializing class SessionFactoryObjectFactory
14:49:50,234 DEBUG SessionFactoryObjectFactory:76 - registered: 8a8181bf07340ee10107340ee4fb0000 (unnamed)
14:49:50,234  INFO SessionFactoryObjectFactory:82 - Not binding factory to JNDI, no JNDI name configured
14:49:50,234 DEBUG SessionFactoryImpl:262 - instantiated session factory
14:49:50,234  INFO Dialect:92 - Using dialect: org.hibernate.dialect.Oracle9Dialect
14:49:50,281  INFO Configuration:875 - processing extends queue
14:49:50,281  INFO Configuration:879 - processing collection mappings
14:49:50,281  INFO Configuration:888 - processing association property references
14:49:50,281  INFO Configuration:917 - processing foreign key constraints
14:49:50,281 DEBUG Configuration:964 - resolving reference to class: gov.mtc.agenda.beans.event.Committee
14:49:50,281  INFO Configuration:875 - processing extends queue
14:49:50,281  INFO Configuration:879 - processing collection mappings
14:49:50,281  INFO Configuration:888 - processing association property references
14:49:50,281  INFO Configuration:917 - processing foreign key constraints
14:49:50,281 DEBUG Configuration:964 - resolving reference to class: gov.mtc.agenda.beans.event.Committee
14:49:50,281  INFO SchemaExport:113 - Running hbm2ddl schema export
14:49:50,281  INFO SchemaExport:129 - exporting generated schema to database
14:49:50,281  INFO DriverManagerConnectionProvider:41 - Using Hibernate built-in connection pool (not for production use!)
14:49:50,359  INFO DriverManagerConnectionProvider:42 - Hibernate connection pool size: 20
14:49:50,359  INFO DriverManagerConnectionProvider:45 - autocommit mode: false
14:49:50,359  INFO DriverManagerConnectionProvider:80 - using driver: oracle.jdbc.driver.OracleDriver at URL: jdbc:oracle:thin:@localhost:1521:WORKDB
14:49:50,359  INFO DriverManagerConnectionProvider:83 - connection properties: {user=agendahibernate, password=*****, shutdown=true}
14:49:50,359 DEBUG DriverManagerConnectionProvider:93 - total checked-out connections: 0
14:49:50,359 DEBUG DriverManagerConnectionProvider:109 - opening new JDBC connection
14:49:50,453 DEBUG DriverManagerConnectionProvider:115 - created connection to: jdbc:oracle:thin:@localhost:1521:WORKDB, Isolation Level: 2
14:49:50,453 DEBUG SchemaExport:143 - drop table COMMITTEE cascade constraints
14:49:50,531 DEBUG SchemaExport:143 - drop table EVENT cascade constraints
14:49:50,578 DEBUG SchemaExport:143 - drop table PERSON cascade constraints
14:49:50,609 DEBUG SchemaExport:143 - drop sequence hibernate_sequence
14:49:50,625 DEBUG SchemaExport:161 - create table COMMITTEE (
    ID number(19,0) not null,
    name varchar2(255),
    description varchar2(4000),
    primary key (ID)
)
14:49:50,640 DEBUG SchemaExport:161 - create table EVENT (
    ID number(19,0) not null,
    name varchar2(255),
    notes varchar2(4000),
    eventDate date,
    timeComment varchar2(4000),
    endtime date,
    nextMeetingDate date,
    COMMITTEE_ID number(19,0) not null,
    revisedagenda number(1,0),
    audiocast number(1,0),
    hide number(1,0),
    modified date,
    audiocastmarker varchar2(255),
    primary key (ID)
)
14:49:50,656 DEBUG SchemaExport:161 - create table PERSON (
    ID number(19,0) not null,
    honorific varchar2(255),
    firstName varchar2(255),
    middleName varchar2(255),
    lastName varchar2(255),
    email varchar2(255),
    phone varchar2(15),
    notes varchar2(4000),
    modified timestamp,
    represents varchar2(255),
    nameSuffix varchar2(255),
    primary key (ID)
)
14:49:50,703 DEBUG SchemaExport:161 - alter table EVENT
    add constraint FK3F47A7AB9BE5F0B
    foreign key (COMMITTEE_ID)
    references COMMITTEE
14:49:50,734 DEBUG SchemaExport:161 - create sequence hibernate_sequence
14:49:50,734  INFO SchemaExport:173 - schema export complete
14:49:50,734 DEBUG DriverManagerConnectionProvider:129 - returning connection to pool, pool size: 1
14:49:50,734  INFO DriverManagerConnectionProvider:147 - cleaning up connection pool: jdbc:oracle:thin:@localhost:1521:WORKDB
14:49:50,734  INFO SessionFactoryImpl:379 - Checking 0 named queries
14:49:50,796 DEBUG SessionImpl:250 - opened session at timestamp: 4630322342846464
14:49:50,796 DEBUG JDBCTransaction:46 - begin
14:49:50,796 DEBUG ConnectionManager:296 - opening JDBC connection
14:49:50,796 DEBUG DriverManagerConnectionProvider:93 - total checked-out connections: 0
14:49:50,796 DEBUG DriverManagerConnectionProvider:99 - using pooled JDBC connection, pool size: 0
14:49:50,796 DEBUG JDBCTransaction:50 - current autocommit status: false
14:49:50,828 DEBUG DefaultSaveOrUpdateEventListener:159 - saving transient instance
14:49:50,828 DEBUG AbstractBatcher:290 - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
14:49:50,828 DEBUG SQL:324 - select hibernate_sequence.nextval from dual
Hibernate: select hibernate_sequence.nextval from dual
14:49:50,828 DEBUG AbstractBatcher:378 - preparing statement
14:49:50,875 DEBUG SequenceGenerator:87 - Sequence identifier generated: 1
14:49:50,875 DEBUG AbstractBatcher:298 - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
14:49:50,875 DEBUG AbstractBatcher:416 - closing statement
14:49:50,875 DEBUG AbstractSaveEventListener:100 - generated identifier: 1, using strategy: org.hibernate.id.SequenceGenerator
14:49:50,875 DEBUG AbstractSaveEventListener:133 - saving [gov.mtc.agenda.beans.event.Committee#1]
14:49:50,890 DEBUG Cascades:836 - processing cascade ACTION_SAVE_UPDATE for: gov.mtc.agenda.beans.event.Committee
14:49:50,890 DEBUG Cascades:861 - done processing cascade ACTION_SAVE_UPDATE for: gov.mtc.agenda.beans.event.Committee
14:49:50,921 DEBUG WrapVisitor:86 - Wrapped collection in role: gov.mtc.agenda.beans.event.Committee.events
14:49:50,921 DEBUG Cascades:836 - processing cascade ACTION_SAVE_UPDATE for: gov.mtc.agenda.beans.event.Committee
14:49:50,921 DEBUG Cascades:890 - cascade ACTION_SAVE_UPDATE for collection: gov.mtc.agenda.beans.event.Committee.events
14:49:50,921 DEBUG Cascades:153 - cascading to saveOrUpdate: gov.mtc.agenda.beans.event.Event
14:49:50,937 DEBUG Cascades:575 - id unsaved-value strategy NULL
14:49:50,937 DEBUG AbstractSaveEventListener:414 - detached instance of: gov.mtc.agenda.beans.event.Event
14:49:50,937 DEBUG DefaultSaveOrUpdateEventListener:200 - updating detached instance
14:49:50,937 DEBUG DefaultSaveOrUpdateEventListener:246 - updating [gov.mtc.agenda.beans.event.Event#0]
14:49:50,937 DEBUG DefaultSaveOrUpdateEventListener:296 - updating [gov.mtc.agenda.beans.event.Event#0]
14:49:50,937 DEBUG Cascades:153 - cascading to saveOrUpdate: gov.mtc.agenda.beans.event.Event
14:49:50,937 DEBUG Cascades:575 - id unsaved-value strategy NULL
14:49:50,937 DEBUG AbstractSaveEventListener:414 - detached instance of: gov.mtc.agenda.beans.event.Event
14:49:50,937 DEBUG DefaultSaveOrUpdateEventListener:200 - updating detached instance
14:49:50,937 DEBUG DefaultSaveOrUpdateEventListener:246 - updating [gov.mtc.agenda.beans.event.Event#0]


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 27, 2005 6:47 pm 
Newbie

Joined: Tue Oct 18, 2005 8:13 pm
Posts: 4
I figured out the answer.

For searchers:

The parent and child were both new items that weren't in the DB yet. So I created a new Committee, then added a bunch of new Events to its events field. Then tried to save it all into the DB at once. All the Events had an ID of null --- hence not unique IDs.

Got to create the Committee, save it, then create and save each of the events (in a separate session I guess).


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 28, 2005 3:21 am 
Senior
Senior

Joined: Thu Aug 04, 2005 4:54 am
Posts: 153
Location: Birmingham, UK
Or you didn't correctly implement equals and hashcode.


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

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.