-->
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.  [ 4 posts ] 
Author Message
 Post subject: help with updating for detached records
PostPosted: Tue Mar 08, 2005 8:14 am 
Newbie

Joined: Fri Mar 04, 2005 7:10 am
Posts: 12
having a problem understanding the behaviour of updating objects and how one to many /many to one updates work.

I have declared a customer class and a sites class (where initially the site record is not a true child of customer (i have not set the foreign key in sites to be not null)

When I run this it results in 1 customer record and 2 sites, the 3rd site where i set the customer directly on the site never propogates into any changes and the record is never persisted.

dont really understand what the platform is doing - at a database level if I create a site and set the foreign key to be an existing customer then the join is made. This allows for creates/updates from the non inverse end of the relation. However in this case it look as though I have to use the addSite routine from the customer which sets the foreign key of the site and adds the site to the set before I get the transitive create to the site into the DB

I have added a direct pm.add (thrdSite) call and this creates the third site directly - though I havnt tried to see if the cust Sites attribute gets updated i assume it cant and i have to reload the cust record to get a fresh query back from the db.

does a casde="all" work from the many side back into the one side of a relationship or is that a redundant attribute on the many side of the mapping?


Code:
    //public method of customer
    public boolean addSite(Site site)
    {
        // force the update from the dependent class
        site.setCustomer(this);
       
        if (sites == null)
            sites = new HashSet<Site>();
       
       
        return this.sites.add(site);
    }
 




Hibernate version v/rc1:

Mapping documents:

customer:
Code:
<hibernate-mapping package="customer">
   
   <class name="Customer" table="Customer" >
      <id name="custID" type = "long" column="custID" unsaved-value="0" >
         <generator class="increment"/>
      </id>

      <version name="version"
                 type="int"
                 column="version"/>

      <property name="key" type = "long" column="uniqueKey" not-null="true"/>
      <property name="name" type = "java.lang.String" column="custName" length="100" not-null="true"/>
      <property name="nameAlias" type = "java.lang.String" column="custNameAlias" length="100" />


      <map name="flexAtt" table="CustAttVals" cascade="all">
         <key column="custID"/>
         <map-key column="attribute" type="java.lang.String"/>
         <element column="value" type="java.lang.String"/>
      </map>

      
      <set name="sites" table="Site" cascade="all" inverse="true" lazy = "true">
         <key column="custID"/>
         <one-to-many class="customer.Site"/>
      </set>

      
   </class>


</hibernate-mapping>


site:
Code:
hibernate-mapping package="customer">
   
   <class name="Site" table="Site">
      <id name="siteID" type="long" column="siteID" unsaved-value="0">
         <generator class="increment"/>
      </id>

      <property name="name" type = "java.lang.String" column = "name" length="100"/>
      <property name="customerNameAlias" type = "java.lang.String" column="customerNameAlias" length="100" />

      <!-- single class ref -->
      <many-to-one name="customer" class="customer.Customer" column="custID"  cascade="all" lazy = "true"/>

   </class>
</hibernate-mapping>



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

I have a helper library - PersistanceManager pm in the code
Code:
        Customer cust = new Customer ();
        cust.setName("Reuters");
        Site site = new Site ();
         site.setName("head office");
        //site.setCustomer(cust);
        cust.addSite(site);
        pm.add (cust);
        pm.dispose();
// the above works fine - the cust record gets created and
// the cascade triggers the site to get created. 
//pm.add (obj) calls saveand update and flushed the session.
//pm dispose closes the session


//I then start another set of updates

        logger.debug("start second set of updates");
//set the cust alias in detached object
        cust.setNameAlias("next");
//create two new sites
        Site secSite = new Site ();
        Site thrdSite = new Site ();
        secSite.setName("local branch");
        thrdSite.setName("DIY branch");
        logger.debug("add sec Site to cust");
//call the addSite of the cust object - this sets site with customer object
// then adds the site to the set in the customer (re chapter 21 in docs)
        cust.addSite(secSite);

        logger.debug("update thrd site with cust ref ");
//try and just set the cust record from the site in 3rd site as inverse="true" is set in the customer Set mapping

        thrdSite.setCustomer(cust);
        logger.debug("reconnect detattched cust, flush second set of updates");

//reconnect the cust object with current session.
        pm.getSession().update(cust);
        pm.getSession().flush();

        pm.dispose();


Name and version of the database you are using: mysql 4.1

The generated SQL (show_sql=true):

4166 [main] DEBUG org.hibernate.util.ReflectHelper - reflection optimizer disabled for: customer.Customer, BulkBeanException: Property is private (property setSites)
4176 [main] DEBUG org.hibernate.persister.entity.BasicEntityPersister - Static SQL for entity: customer.Customer
4176 [main] DEBUG org.hibernate.persister.entity.BasicEntityPersister - Version select: select version from Customer where custID =?
4176 [main] DEBUG org.hibernate.persister.entity.BasicEntityPersister - Snapshot select: select customer_.custID, customer_.version as version7_, customer_.uniqueKey as uniqueKey7_, customer_.custName as custName7_, customer_.custNameAlias as custName5_7_ from Customer customer_ where customer_.custID=?
4176 [main] DEBUG org.hibernate.persister.entity.BasicEntityPersister - Insert 0: insert into Customer (version, uniqueKey, custName, custNameAlias, custID) values (?, ?, ?, ?, ?)
4176 [main] DEBUG org.hibernate.persister.entity.BasicEntityPersister - Update 0: update Customer set version=?, uniqueKey=?, custName=?, custNameAlias=? where custID=? and version=?
4176 [main] DEBUG org.hibernate.persister.entity.BasicEntityPersister - Delete 0: delete from Customer where custID=? and version=?
4276 [main] DEBUG org.hibernate.persister.entity.BasicEntityPersister - Static SQL for entity: inventory.VirtualNetwork
4276 [main] DEBUG org.hibernate.persister.entity.BasicEntityPersister - Version select: select version from VirtualNetwork where id =?
4276 [main] DEBUG org.hibernate.persister.entity.BasicEntityPersister - Snapshot select: select virtualnet_.id, virtualnet_.version as version10_, virtualnet_.name as name10_, virtualnet_.nameAlias as nameAlias10_, virtualnet_.bandwidth as bandwidth11_, virtualnet_.vci as vci11_, virtualnet_.vpi as vpi11_ from VirtualNetwork virtualnet_ where virtualnet_.id=?
4276 [main] DEBUG org.hibernate.persister.entity.BasicEntityPersister - Insert 0: insert into VirtualNetwork (version, uniqueKey, name, nameAlias, bandwidth, vci, vpi, id) values (?, ?, ?, ?, ?, ?, ?, ?)
4276 [main] DEBUG org.hibernate.persister.entity.BasicEntityPersister - Update 0: update VirtualNetwork set version=?, name=?, nameAlias=?, bandwidth=?, vci=?, vpi=? where id=? and version=?
4276 [main] DEBUG org.hibernate.persister.entity.BasicEntityPersister - Delete 0: delete from VirtualNetwork where id=? and version=?
4286 [main] DEBUG org.hibernate.persister.collection.AbstractCollectionPersister - Static SQL for collection: inventory.VirtualNetwork.flexAtt
4296 [main] DEBUG org.hibernate.persister.collection.AbstractCollectionPersister - Row insert: insert into VNAttVals (id, attribute, value) values (?, ?, ?)
4296 [main] DEBUG org.hibernate.persister.collection.AbstractCollectionPersister - Row update: update VNAttVals set value=? where id=? and attribute=?
4296 [main] DEBUG org.hibernate.persister.collection.AbstractCollectionPersister - Row delete: delete from VNAttVals where id=? and attribute=?
4296 [main] DEBUG org.hibernate.persister.collection.AbstractCollectionPersister - One-shot delete: delete from VNAttVals where id=?
4296 [main] DEBUG org.hibernate.persister.collection.AbstractCollectionPersister - Static SQL for collection: customer.Customer.sites
4296 [main] DEBUG org.hibernate.persister.collection.AbstractCollectionPersister - Row insert: update Site set custID=? where siteID=?
4296 [main] DEBUG org.hibernate.persister.collection.AbstractCollectionPersister - Row delete: update Site set custID=null where siteID=?
4296 [main] DEBUG org.hibernate.persister.collection.AbstractCollectionPersister - One-shot delete: update Site set custID=null where custID=?
4306 [main] DEBUG org.hibernate.persister.collection.AbstractCollectionPersister - Static SQL for collection: inventory.NetworkService.cpe
4306 [main] DEBUG org.hibernate.persister.collection.AbstractCollectionPersister - Row insert: insert into cpe_ns (nsID, cpeID) values (?, ?)
4306 [main] DEBUG org.hibernate.persister.collection.AbstractCollectionPersister - Row update: update cpe_ns set cpeID=? where nsID=? and cpeID=?
4306 [main] DEBUG org.hibernate.persister.collection.AbstractCollectionPersister - Row delete: delete from cpe_ns where nsID=? and cpeID=?
4306 [main] DEBUG org.hibernate.persister.collection.AbstractCollectionPersister - One-shot delete: delete from cpe_ns where nsID=?
4306 [main] DEBUG org.hibernate.persister.collection.AbstractCollectionPersister - Static SQL for collection: inventory.Bearer.cpe
4306 [main] DEBUG org.hibernate.persister.collection.AbstractCollectionPersister - Row insert: insert into cpe_bin (binID, cpeID) values (?, ?)
4306 [main] DEBUG org.hibernate.persister.collection.AbstractCollectionPersister - Row update: update cpe_bin set cpeID=? where binID=? and cpeID=?
4306 [main] DEBUG org.hibernate.persister.collection.AbstractCollectionPersister - Row delete: delete from cpe_bin where binID=? and cpeID=?
4306 [main] DEBUG org.hibernate.persister.collection.AbstractCollectionPersister - One-shot delete: delete from cpe_bin where binID=?
4306 [main] DEBUG org.hibernate.persister.collection.AbstractCollectionPersister - Static SQL for collection: inventory.CPE.bearers
4306 [main] DEBUG org.hibernate.persister.collection.AbstractCollectionPersister - Row insert: insert into cpe_bin (cpeID, binID) values (?, ?)
4306 [main] DEBUG org.hibernate.persister.collection.AbstractCollectionPersister - Row update: update cpe_bin set binID=? where cpeID=? and binID=?
4306 [main] DEBUG org.hibernate.persister.collection.AbstractCollectionPersister - Row delete: delete from cpe_bin where cpeID=? and binID=?
4316 [main] DEBUG org.hibernate.persister.collection.AbstractCollectionPersister - One-shot delete: delete from cpe_bin where cpeID=?
4316 [main] DEBUG org.hibernate.persister.collection.AbstractCollectionPersister - Static SQL for collection: customer.Customer.flexAtt
4316 [main] DEBUG org.hibernate.persister.collection.AbstractCollectionPersister - Row insert: insert into CustAttVals (custID, attribute, value) values (?, ?, ?)
4316 [main] DEBUG org.hibernate.persister.collection.AbstractCollectionPersister - Row update: update CustAttVals set value=? where custID=? and attribute=?
4316 [main] DEBUG org.hibernate.persister.collection.AbstractCollectionPersister - Row delete: delete from CustAttVals where custID=? and attribute=?
4316 [main] DEBUG org.hibernate.persister.collection.AbstractCollectionPersister - One-shot delete: delete from CustAttVals where custID=?
4316 [main] DEBUG org.hibernate.persister.collection.AbstractCollectionPersister - Static SQL for collection: inventory.NetworkService.bearerServices
4316 [main] DEBUG org.hibernate.persister.collection.AbstractCollectionPersister - Row insert: insert into ns_bin (nsID, binID) values (?, ?)
4326 [main] DEBUG org.hibernate.persister.collection.AbstractCollectionPersister - Row update: update ns_bin set binID=? where nsID=? and binID=?
4326 [main] DEBUG org.hibernate.persister.collection.AbstractCollectionPersister - Row delete: delete from ns_bin where nsID=? and binID=?
4326 [main] DEBUG org.hibernate.persister.collection.AbstractCollectionPersister - One-shot delete: delete from ns_bin where nsID=?
4326 [main] DEBUG org.hibernate.persister.collection.AbstractCollectionPersister - Static SQL for collection: inventory.CPE.networkServices
4326 [main] DEBUG org.hibernate.persister.collection.AbstractCollectionPersister - Row insert: insert into cpe_ns (cpeID, nsID) values (?, ?)
4326 [main] DEBUG org.hibernate.persister.collection.AbstractCollectionPersister - Row update: update cpe_ns set nsID=? where cpeID=? and nsID=?
4336 [main] DEBUG org.hibernate.persister.collection.AbstractCollectionPersister - Row delete: delete from cpe_ns where cpeID=? and nsID=?
4336 [main] DEBUG org.hibernate.persister.collection.AbstractCollectionPersister - One-shot delete: delete from cpe_ns where cpeID=?
4346 [main] DEBUG org.hibernate.persister.collection.AbstractCollectionPersister - Static SQL for collection: inventory.Bearer.networkServices
4346 [main] DEBUG org.hibernate.persister.collection.AbstractCollectionPersister - Row insert: insert into ns_bin (binID, nsID) values (?, ?)
4346 [main] DEBUG org.hibernate.persister.collection.AbstractCollectionPersister - Row update: update ns_bin set nsID=? where binID=? and nsID=?
4346 [main] DEBUG org.hibernate.persister.collection.AbstractCollectionPersister - Row delete: delete from ns_bin where binID=? and nsID=?
4346 [main] DEBUG org.hibernate.persister.collection.AbstractCollectionPersister - One-shot delete: delete from ns_bin where binID=?
4386 [main] DEBUG org.hibernate.loader.entity.EntityLoader - Static select for entity inventory.NetworkService: select networkser0_.nsID as nsID0_, networkser0_.bearerIdentifier as bearerId2_4_0_, networkser0_.bandwidth as bandwidth4_0_ from NetworkServiceInstances networkser0_ where networkser0_.nsID=?
4386 [main] DEBUG org.hibernate.loader.entity.EntityLoader - Static select for entity inventory.NetworkService: select networkser0_.nsID as nsID0_, networkser0_.bearerIdentifier as bearerId2_4_0_, networkser0_.bandwidth as bandwidth4_0_ from NetworkServiceInstances networkser0_ where networkser0_.nsID=?
4386 [main] DEBUG org.hibernate.loader.entity.EntityLoader - Static select for entity inventory.NetworkService: select networkser0_.nsID as nsID0_, networkser0_.bearerIdentifier as bearerId2_4_0_, networkser0_.bandwidth as bandwidth4_0_ from NetworkServiceInstances networkser0_ where networkser0_.nsID=? for update
4396 [main] DEBUG org.hibernate.loader.entity.EntityLoader - Static select for entity inventory.NetworkService: select networkser0_.nsID as nsID0_, networkser0_.bearerIdentifier as bearerId2_4_0_, networkser0_.bandwidth as bandwidth4_0_ from NetworkServiceInstances networkser0_ where networkser0_.nsID=? for update
4396 [main] DEBUG org.hibernate.loader.entity.EntityLoader - Static select for entity inventory.CPE: select cpe0_.cpeID as cpeID0_, cpe0_.CPEIdentifier as CPEIdent2_1_0_, cpe0_.assetNumber as assetNum3_1_0_, cpe0_.siteID_FK as siteID4_1_0_ from CPE cpe0_ where cpe0_.cpeID=?
4406 [main] DEBUG org.hibernate.loader.entity.EntityLoader - Static select for entity inventory.CPE: select cpe0_.cpeID as cpeID0_, cpe0_.CPEIdentifier as CPEIdent2_1_0_, cpe0_.assetNumber as assetNum3_1_0_, cpe0_.siteID_FK as siteID4_1_0_ from CPE cpe0_ where cpe0_.cpeID=?
4406 [main] DEBUG org.hibernate.loader.entity.EntityLoader - Static select for entity inventory.CPE: select cpe0_.cpeID as cpeID0_, cpe0_.CPEIdentifier as CPEIdent2_1_0_, cpe0_.assetNumber as assetNum3_1_0_, cpe0_.siteID_FK as siteID4_1_0_ from CPE cpe0_ where cpe0_.cpeID=? for update
4406 [main] DEBUG org.hibernate.loader.entity.EntityLoader - Static select for entity inventory.CPE: select cpe0_.cpeID as cpeID0_, cpe0_.CPEIdentifier as CPEIdent2_1_0_, cpe0_.assetNumber as assetNum3_1_0_, cpe0_.siteID_FK as siteID4_1_0_ from CPE cpe0_ where cpe0_.cpeID=? for update
4406 [main] DEBUG org.hibernate.loader.entity.EntityLoader - Static select for entity inventory.Element: select element0_.id as id0_, element0_.version as version10_0_, element0_.uniqueKey as uniqueKey10_0_, element0_.name as name10_0_, element0_.nameAlias as nameAlias10_0_, element0_.bandwidth as bandwidth11_0_, element0_.vci as vci11_0_, element0_.vpi as vpi11_0_, element0_.clazz_ as clazz_0_ from ( select vci, bandwidth, nameAlias, vpi, uniqueKey, name, id, version, 1 as clazz_ from VirtualNetwork ) element0_ where element0_.id=?
4406 [main] DEBUG org.hibernate.loader.entity.EntityLoader - Static select for entity inventory.Element: select element0_.id as id0_, element0_.version as version10_0_, element0_.uniqueKey as uniqueKey10_0_, element0_.name as name10_0_, element0_.nameAlias as nameAlias10_0_, element0_.bandwidth as bandwidth11_0_, element0_.vci as vci11_0_, element0_.vpi as vpi11_0_, element0_.clazz_ as clazz_0_ from ( select vci, bandwidth, nameAlias, vpi, uniqueKey, name, id, version, 1 as clazz_ from VirtualNetwork ) element0_ where element0_.id=?
4406 [main] DEBUG org.hibernate.loader.entity.EntityLoader - Static select for entity inventory.Element: select element0_.id as id0_, element0_.version as version10_0_, element0_.uniqueKey as uniqueKey10_0_, element0_.name as name10_0_, element0_.nameAlias as nameAlias10_0_, element0_.bandwidth as bandwidth11_0_, element0_.vci as vci11_0_, element0_.vpi as vpi11_0_, element0_.clazz_ as clazz_0_ from ( select vci, bandwidth, nameAlias, vpi, uniqueKey, name, id, version, 1 as clazz_ from VirtualNetwork ) element0_ where element0_.id=? for update
4406 [main] DEBUG org.hibernate.loader.entity.EntityLoader - Static select for entity inventory.Element: select element0_.id as id0_, element0_.version as version10_0_, element0_.uniqueKey as uniqueKey10_0_, element0_.name as name10_0_, element0_.nameAlias as nameAlias10_0_, element0_.bandwidth as bandwidth11_0_, element0_.vci as vci11_0_, element0_.vpi as vpi11_0_, element0_.clazz_ as clazz_0_ from ( select vci, bandwidth, nameAlias, vpi, uniqueKey, name, id, version, 1 as clazz_ from VirtualNetwork ) element0_ where element0_.id=? for update
4406 [main] DEBUG org.hibernate.loader.entity.EntityLoader - Static select for entity inventory.Bearer: select bearer0_.binID as binID0_, bearer0_.bearerIdentifier as bearerId2_6_0_, bearer0_.bandwidth as bandwidth6_0_ from BearerInstances bearer0_ where bearer0_.binID=?
4406 [main] DEBUG org.hibernate.loader.entity.EntityLoader - Static select for entity inventory.Bearer: select bearer0_.binID as binID0_, bearer0_.bearerIdentifier as bearerId2_6_0_, bearer0_.bandwidth as bandwidth6_0_ from BearerInstances bearer0_ where bearer0_.binID=?
4406 [main] DEBUG org.hibernate.loader.entity.EntityLoader - Static select for entity inventory.Bearer: select bearer0_.binID as binID0_, bearer0_.bearerIdentifier as bearerId2_6_0_, bearer0_.bandwidth as bandwidth6_0_ from BearerInstances bearer0_ where bearer0_.binID=? for update
4406 [main] DEBUG org.hibernate.loader.entity.EntityLoader - Static select for entity inventory.Bearer: select bearer0_.binID as binID0_, bearer0_.bearerIdentifier as bearerId2_6_0_, bearer0_.bandwidth as bandwidth6_0_ from BearerInstances bearer0_ where bearer0_.binID=? for update
4406 [main] DEBUG org.hibernate.loader.entity.EntityLoader - Static select for entity customer.Site: select site0_.siteID as siteID0_, site0_.name as name9_0_, site0_.customerNameAlias as customer3_9_0_, site0_.custID as custID9_0_ from Site site0_ where site0_.siteID=?
4416 [main] DEBUG org.hibernate.loader.entity.EntityLoader - Static select for entity customer.Site: select site0_.siteID as siteID0_, site0_.name as name9_0_, site0_.customerNameAlias as customer3_9_0_, site0_.custID as custID9_0_ from Site site0_ where site0_.siteID=?
4416 [main] DEBUG org.hibernate.loader.entity.EntityLoader - Static select for entity customer.Site: select site0_.siteID as siteID0_, site0_.name as name9_0_, site0_.customerNameAlias as customer3_9_0_, site0_.custID as custID9_0_ from Site site0_ where site0_.siteID=? for update
4426 [main] DEBUG org.hibernate.loader.entity.EntityLoader - Static select for entity customer.Site: select site0_.siteID as siteID0_, site0_.name as name9_0_, site0_.customerNameAlias as customer3_9_0_, site0_.custID as custID9_0_ from Site site0_ where site0_.siteID=? for update
4426 [main] DEBUG org.hibernate.loader.entity.EntityLoader - Static select for entity hibernatedemo.ContactInfo: select contactinf0_.con_id_pk as con1_0_, contactinf0_.firstName as firstName0_0_, contactinf0_.lastName as lastName0_0_, contactinf0_.phoneAreaCode as phoneAre4_0_0_, contactinf0_.phoneCountryCode as phoneCou5_0_0_, contactinf0_.phoneNumber as phoneNum6_0_0_ from Contact contactinf0_ where contactinf0_.con_id_pk=?
4426 [main] DEBUG org.hibernate.loader.entity.EntityLoader - Static select for entity hibernatedemo.ContactInfo: select contactinf0_.con_id_pk as con1_0_, contactinf0_.firstName as firstName0_0_, contactinf0_.lastName as lastName0_0_, contactinf0_.phoneAreaCode as phoneAre4_0_0_, contactinf0_.phoneCountryCode as phoneCou5_0_0_, contactinf0_.phoneNumber as phoneNum6_0_0_ from Contact contactinf0_ where contactinf0_.con_id_pk=?
4426 [main] DEBUG org.hibernate.loader.entity.EntityLoader - Static select for entity hibernatedemo.ContactInfo: select contactinf0_.con_id_pk as con1_0_, contactinf0_.firstName as firstName0_0_, contactinf0_.lastName as lastName0_0_, contactinf0_.phoneAreaCode as phoneAre4_0_0_, contactinf0_.phoneCountryCode as phoneCou5_0_0_, contactinf0_.phoneNumber as phoneNum6_0_0_ from Contact contactinf0_ where contactinf0_.con_id_pk=? for update
4426 [main] DEBUG org.hibernate.loader.entity.EntityLoader - Static select for entity hibernatedemo.ContactInfo: select contactinf0_.con_id_pk as con1_0_, contactinf0_.firstName as firstName0_0_, contactinf0_.lastName as lastName0_0_, contactinf0_.phoneAreaCode as phoneAre4_0_0_, contactinf0_.phoneCountryCode as phoneCou5_0_0_, contactinf0_.phoneNumber as phoneNum6_0_0_ from Contact contactinf0_ where contactinf0_.con_id_pk=? for update
4426 [main] DEBUG org.hibernate.loader.entity.EntityLoader - Static select for entity customer.Customer: select customer0_.custID as custID0_, customer0_.version as version7_0_, customer0_.uniqueKey as uniqueKey7_0_, customer0_.custName as custName7_0_, customer0_.custNameAlias as custName5_7_0_ from Customer customer0_ where customer0_.custID=?
4426 [main] DEBUG org.hibernate.loader.entity.EntityLoader - Static select for entity customer.Customer: select customer0_.custID as custID0_, customer0_.version as version7_0_, customer0_.uniqueKey as uniqueKey7_0_, customer0_.custName as custName7_0_, customer0_.custNameAlias as custName5_7_0_ from Customer customer0_ where customer0_.custID=?
4426 [main] DEBUG org.hibernate.loader.entity.EntityLoader - Static select for entity customer.Customer: select customer0_.custID as custID0_, customer0_.version as version7_0_, customer0_.uniqueKey as uniqueKey7_0_, customer0_.custName as custName7_0_, customer0_.custNameAlias as custName5_7_0_ from Customer customer0_ where customer0_.custID=? for update
4436 [main] DEBUG org.hibernate.loader.entity.EntityLoader - Static select for entity customer.Customer: select customer0_.custID as custID0_, customer0_.version as version7_0_, customer0_.uniqueKey as uniqueKey7_0_, customer0_.custName as custName7_0_, customer0_.custNameAlias as custName5_7_0_ from Customer customer0_ where customer0_.custID=? for update
4436 [main] DEBUG org.hibernate.loader.entity.EntityLoader - Static select for entity inventory.VirtualNetwork: select virtualnet0_.id as id0_, virtualnet0_.version as version10_0_, virtualnet0_.uniqueKey as uniqueKey10_0_, virtualnet0_.name as name10_0_, virtualnet0_.nameAlias as nameAlias10_0_, virtualnet0_.bandwidth as bandwidth11_0_, virtualnet0_.vci as vci11_0_, virtualnet0_.vpi as vpi11_0_ from VirtualNetwork virtualnet0_ where virtualnet0_.id=?
4447 [main] DEBUG org.hibernate.loader.entity.EntityLoader - Static select for entity inventory.VirtualNetwork: select virtualnet0_.id as id0_, virtualnet0_.version as version10_0_, virtualnet0_.uniqueKey as uniqueKey10_0_, virtualnet0_.name as name10_0_, virtualnet0_.nameAlias as nameAlias10_0_, virtualnet0_.bandwidth as bandwidth11_0_, virtualnet0_.vci as vci11_0_, virtualnet0_.vpi as vpi11_0_ from VirtualNetwork virtualnet0_ where virtualnet0_.id=?
4447 [main] DEBUG org.hibernate.loader.entity.EntityLoader - Static select for entity inventory.VirtualNetwork: select virtualnet0_.id as id0_, virtualnet0_.version as version10_0_, virtualnet0_.uniqueKey as uniqueKey10_0_, virtualnet0_.name as name10_0_, virtualnet0_.nameAlias as nameAlias10_0_, virtualnet0_.bandwidth as bandwidth11_0_, virtualnet0_.vci as vci11_0_, virtualnet0_.vpi as vpi11_0_ from VirtualNetwork virtualnet0_ where virtualnet0_.id=? for update
4447 [main] DEBUG org.hibernate.loader.entity.EntityLoader - Static select for entity inventory.VirtualNetwork: select virtualnet0_.id as id0_, virtualnet0_.version as version10_0_, virtualnet0_.uniqueKey as uniqueKey10_0_, virtualnet0_.name as name10_0_, virtualnet0_.nameAlias as nameAlias10_0_, virtualnet0_.bandwidth as bandwidth11_0_, virtualnet0_.vci as vci11_0_, virtualnet0_.vpi as vpi11_0_ from VirtualNetwork virtualnet0_ where virtualnet0_.id=? for update
4457 [main] DEBUG org.hibernate.loader.collection.CollectionLoader - Static select for collection inventory.NetworkService.cpe: select cpe0_.nsID as nsID__, cpe0_.cpeID as cpeID__, cpe1_.cpeID as cpeID0_, cpe1_.CPEIdentifier as CPEIdent2_1_0_, cpe1_.assetNumber as assetNum3_1_0_, cpe1_.siteID_FK as siteID4_1_0_ from cpe_ns cpe0_ inner join CPE cpe1_ on cpe0_.cpeID=cpe1_.cpeID where cpe0_.nsID=?
4457 [main] DEBUG org.hibernate.loader.collection.OneToManyLoader - Static select for one-to-many customer.Customer.sites: select sites0_.custID as custID__, sites0_.siteID as siteID__, sites0_.siteID as siteID0_, sites0_.name as name9_0_, sites0_.customerNameAlias as customer3_9_0_, sites0_.custID as custID9_0_ from Site sites0_ where sites0_.custID=?
4467 [main] DEBUG org.hibernate.loader.collection.CollectionLoader - Static select for collection inventory.VirtualNetwork.flexAtt: select flexatt0_.id as id__, flexatt0_.value as value__, flexatt0_.attribute as attribute__ from VNAttVals flexatt0_ where flexatt0_.id=?
4467 [main] DEBUG org.hibernate.loader.collection.CollectionLoader - Static select for collection inventory.Bearer.cpe: select cpe0_.binID as binID__, cpe0_.cpeID as cpeID__, cpe1_.cpeID as cpeID0_, cpe1_.CPEIdentifier as CPEIdent2_1_0_, cpe1_.assetNumber as assetNum3_1_0_, cpe1_.siteID_FK as siteID4_1_0_ from cpe_bin cpe0_ inner join CPE cpe1_ on cpe0_.cpeID=cpe1_.cpeID where cpe0_.binID=?
4467 [main] DEBUG org.hibernate.loader.collection.CollectionLoader - Static select for collection inventory.CPE.bearers: select bearers0_.cpeID as cpeID__, bearers0_.binID as binID__, bearer1_.binID as binID0_, bearer1_.bearerIdentifier as bearerId2_6_0_, bearer1_.bandwidth as bandwidth6_0_ from cpe_bin bearers0_ inner join BearerInstances bearer1_ on bearers0_.binID=bearer1_.binID where bearers0_.cpeID=?
4467 [main] DEBUG org.hibernate.loader.collection.CollectionLoader - Static select for collection customer.Customer.flexAtt: select flexatt0_.custID as custID__, flexatt0_.value as value__, flexatt0_.attribute as attribute__ from CustAttVals flexatt0_ where flexatt0_.custID=?
4467 [main] DEBUG org.hibernate.loader.collection.CollectionLoader - Static select for collection inventory.CPE.networkServices: select networkser0_.cpeID as cpeID__, networkser0_.nsID as nsID__, networkser1_.nsID as nsID0_, networkser1_.bearerIdentifier as bearerId2_4_0_, networkser1_.bandwidth as bandwidth4_0_ from cpe_ns networkser0_ inner join NetworkServiceInstances networkser1_ on networkser0_.nsID=networkser1_.nsID where networkser0_.cpeID=?
4467 [main] DEBUG org.hibernate.loader.collection.CollectionLoader - Static select for collection inventory.NetworkService.bearerServices: select bearerserv0_.nsID as nsID__, bearerserv0_.binID as binID__, bearer1_.binID as binID0_, bearer1_.bearerIdentifier as bearerId2_6_0_, bearer1_.bandwidth as bandwidth6_0_ from ns_bin bearerserv0_ inner join BearerInstances bearer1_ on bearerserv0_.binID=bearer1_.binID where bearerserv0_.nsID=?
4467 [main] DEBUG org.hibernate.loader.collection.CollectionLoader - Static select for collection inventory.Bearer.networkServices: select networkser0_.binID as binID__, networkser0_.nsID as nsID__, networkser1_.nsID as nsID0_, networkser1_.bearerIdentifier as bearerId2_4_0_, networkser1_.bandwidth as bandwidth4_0_ from ns_bin networkser0_ inner join NetworkServiceInstances networkser1_ on networkser0_.nsID=networkser1_.nsID where networkser0_.binID=?
4487 [main] DEBUG org.hibernate.impl.SessionFactoryObjectFactory - initializing class SessionFactoryObjectFactory
4487 [main] DEBUG org.hibernate.impl.SessionFactoryObjectFactory - registered: 8a5782010281d594010281d59e6f0000 (unnamed)
4487 [main] INFO org.hibernate.impl.SessionFactoryObjectFactory - Not binding factory to JNDI, no JNDI name configured
4487 [main] DEBUG org.hibernate.impl.SessionFactoryImpl - instantiated session factory
4487 [main] INFO org.hibernate.impl.SessionFactoryImpl - Checking 0 named queries
4667 [main] DEBUG org.hibernate.impl.SessionImpl - opened session
4667 [main] DEBUG org.hibernate.engine.Cascades - version unsaved-value strategy UNDEFINED
4667 [main] DEBUG org.hibernate.engine.Cascades - id unsaved-value: 0
4667 [main] DEBUG org.hibernate.event.def.AbstractSaveEventListener - transient instance of: customer.Customer
4667 [main] DEBUG org.hibernate.event.def.DefaultSaveOrUpdateEventListener - saving transient instance
4677 [main] DEBUG org.hibernate.jdbc.AbstractBatcher - opening JDBC connection
4677 [main] DEBUG org.hibernate.connection.DriverManagerConnectionProvider - total checked-out connections: 0
4677 [main] DEBUG org.hibernate.connection.DriverManagerConnectionProvider - using pooled JDBC connection, pool size: 0
4677 [main] DEBUG org.hibernate.id.IncrementGenerator - fetching initial value: select max(custID) from Customer
4697 [main] DEBUG org.hibernate.id.IncrementGenerator - first free id: 1
4697 [main] DEBUG org.hibernate.event.def.AbstractSaveEventListener - generated identifier: 1, using strategy: org.hibernate.id.IncrementGenerator
4707 [main] DEBUG org.hibernate.event.def.AbstractSaveEventListener - saving [customer.Customer#1]
4707 [main] DEBUG org.hibernate.engine.Cascades - processing cascade ACTION_SAVE_UPDATE for: customer.Customer
4707 [main] DEBUG org.hibernate.engine.Cascades - done processing cascade ACTION_SAVE_UPDATE for: customer.Customer
4717 [main] DEBUG org.hibernate.engine.Versioning - using initial version: 0
4727 [main] DEBUG org.hibernate.event.def.WrapVisitor - Wrapped collection in role: customer.Customer.flexAtt
4737 [main] DEBUG org.hibernate.event.def.WrapVisitor - Wrapped collection in role: customer.Customer.sites
4747 [main] DEBUG org.hibernate.engine.Cascades - processing cascade ACTION_SAVE_UPDATE for: customer.Customer
4757 [main] DEBUG org.hibernate.engine.Cascades - cascade ACTION_SAVE_UPDATE for collection: customer.Customer.sites
4757 [main] DEBUG org.hibernate.engine.Cascades - cascading to saveOrUpdate: customer.Site
4757 [main] DEBUG org.hibernate.engine.Cascades - id unsaved-value: 0
4757 [main] DEBUG org.hibernate.event.def.AbstractSaveEventListener - transient instance of: customer.Site
4757 [main] DEBUG org.hibernate.event.def.DefaultSaveOrUpdateEventListener - saving transient instance
4757 [main] DEBUG org.hibernate.id.IncrementGenerator - fetching initial value: select max(siteID) from Site
4767 [main] DEBUG org.hibernate.id.IncrementGenerator - first free id: 1
4777 [main] DEBUG org.hibernate.event.def.AbstractSaveEventListener - generated identifier: 1, using strategy: org.hibernate.id.IncrementGenerator
4777 [main] DEBUG org.hibernate.event.def.AbstractSaveEventListener - saving [customer.Site#1]
4777 [main] DEBUG org.hibernate.engine.Cascades - processing cascade ACTION_SAVE_UPDATE for: customer.Site
4777 [main] DEBUG org.hibernate.engine.Cascades - cascading to saveOrUpdate: customer.Customer
4777 [main] DEBUG org.hibernate.event.def.AbstractSaveEventListener - persistent instance of: customer.Customer
4777 [main] DEBUG org.hibernate.event.def.DefaultSaveOrUpdateEventListener - ignoring persistent instance
4777 [main] DEBUG org.hibernate.event.def.DefaultSaveOrUpdateEventListener - object already associated with session: [customer.Customer#1]
4787 [main] DEBUG org.hibernate.engine.Cascades - done processing cascade ACTION_SAVE_UPDATE for: customer.Site
4787 [main] DEBUG org.hibernate.engine.Cascades - processing cascade ACTION_SAVE_UPDATE for: customer.Site
4787 [main] DEBUG org.hibernate.engine.Cascades - done processing cascade ACTION_SAVE_UPDATE for: customer.Site
4787 [main] DEBUG org.hibernate.engine.Cascades - done cascade ACTION_SAVE_UPDATE for collection: customer.Customer.sites
4787 [main] DEBUG org.hibernate.engine.Cascades - done processing cascade ACTION_SAVE_UPDATE for: customer.Customer
4787 [main] DEBUG org.hibernate.event.def.AbstractFlushingEventListener - flushing session
4797 [main] DEBUG org.hibernate.event.def.AbstractFlushingEventListener - processing flush-time cascades
4797 [main] DEBUG org.hibernate.engine.Cascades - processing cascade ACTION_SAVE_UPDATE for: customer.Customer
4797 [main] DEBUG org.hibernate.engine.Cascades - cascade ACTION_SAVE_UPDATE for collection: customer.Customer.sites
4797 [main] DEBUG org.hibernate.engine.Cascades - cascading to saveOrUpdate: customer.Site
4797 [main] DEBUG org.hibernate.event.def.AbstractSaveEventListener - persistent instance of: customer.Site
4797 [main] DEBUG org.hibernate.event.def.DefaultSaveOrUpdateEventListener - ignoring persistent instance
4797 [main] DEBUG org.hibernate.event.def.DefaultSaveOrUpdateEventListener - object already associated with session: [customer.Site#1]
4797 [main] DEBUG org.hibernate.engine.Cascades - done cascade ACTION_SAVE_UPDATE for collection: customer.Customer.sites
4797 [main] DEBUG org.hibernate.engine.Cascades - done processing cascade ACTION_SAVE_UPDATE for: customer.Customer
4797 [main] DEBUG org.hibernate.engine.Cascades - processing cascade ACTION_SAVE_UPDATE for: customer.Site
4797 [main] DEBUG org.hibernate.engine.Cascades - cascading to saveOrUpdate: customer.Customer
4797 [main] DEBUG org.hibernate.event.def.AbstractSaveEventListener - persistent instance of: customer.Customer
4797 [main] DEBUG org.hibernate.event.def.DefaultSaveOrUpdateEventListener - ignoring persistent instance
4797 [main] DEBUG org.hibernate.event.def.DefaultSaveOrUpdateEventListener - object already associated with session: [customer.Customer#1]
4807 [main] DEBUG org.hibernate.engine.Cascades - done processing cascade ACTION_SAVE_UPDATE for: customer.Site
4807 [main] DEBUG org.hibernate.event.def.AbstractFlushingEventListener - dirty checking collections
4807 [main] DEBUG org.hibernate.event.def.AbstractFlushingEventListener - Flushing entities and processing referenced collections
4817 [main] DEBUG org.hibernate.engine.Collections - Collection found: [customer.Customer.flexAtt#1], was: [<unreferenced>] (initialized)
4817 [main] DEBUG org.hibernate.engine.Collections - Collection found: [customer.Customer.sites#1], was: [<unreferenced>] (initialized)
4817 [main] DEBUG org.hibernate.event.def.AbstractFlushingEventListener - Processing unreferenced collections
4817 [main] DEBUG org.hibernate.event.def.AbstractFlushingEventListener - Scheduling collection removes/(re)creates/updates
4827 [main] DEBUG org.hibernate.event.def.AbstractFlushingEventListener - Flushed: 2 insertions, 0 updates, 0 deletions to 2 objects
4827 [main] DEBUG org.hibernate.event.def.AbstractFlushingEventListener - Flushed: 2 (re)creations, 0 updates, 0 removals to 2 collections
4827 [main] DEBUG org.hibernate.pretty.Printer - listing entities:
4827 [main] DEBUG org.hibernate.pretty.Printer - customer.Customer{key=-995319828353405357, flexAtt=[], sites=[customer.Site#1], custID=1, name=Reuters, nameAlias=null, version=0}
4827 [main] DEBUG org.hibernate.pretty.Printer - customer.Site{siteID=1, customer=customer.Customer#1, customerNameAlias=null, name=head office}
4827 [main] DEBUG org.hibernate.event.def.AbstractFlushingEventListener - executing flush
4837 [main] DEBUG org.hibernate.persister.entity.BasicEntityPersister - Inserting entity: [customer.Customer#1]
4837 [main] DEBUG org.hibernate.persister.entity.BasicEntityPersister - Version: 0
4837 [main] DEBUG org.hibernate.jdbc.AbstractBatcher - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
4837 [main] DEBUG org.hibernate.SQL - insert into Customer (version, uniqueKey, custName, custNameAlias, custID) values (?, ?, ?, ?, ?)
Hibernate: insert into Customer (version, uniqueKey, custName, custNameAlias, custID) values (?, ?, ?, ?, ?)
4837 [main] DEBUG org.hibernate.jdbc.AbstractBatcher - preparing statement
4837 [main] DEBUG org.hibernate.persister.entity.BasicEntityPersister - Dehydrating entity: [customer.Customer#1]
4837 [main] DEBUG org.hibernate.type.IntegerType - binding '0' to parameter: 1
4847 [main] DEBUG org.hibernate.type.LongType - binding '-995319828353405357' to parameter: 2
4847 [main] DEBUG org.hibernate.type.StringType - binding 'Reuters' to parameter: 3
4847 [main] DEBUG org.hibernate.type.StringType - binding null to parameter: 4
4847 [main] DEBUG org.hibernate.type.LongType - binding '1' to parameter: 5
4847 [main] DEBUG org.hibernate.jdbc.AbstractBatcher - Adding to batch
4847 [main] DEBUG org.hibernate.persister.entity.BasicEntityPersister - Inserting entity: [customer.Site#1]
4847 [main] DEBUG org.hibernate.jdbc.AbstractBatcher - Executing batch size: 1
4857 [main] DEBUG org.hibernate.jdbc.AbstractBatcher - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
4857 [main] DEBUG org.hibernate.jdbc.AbstractBatcher - closing statement
4857 [main] DEBUG org.hibernate.jdbc.AbstractBatcher - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
4857 [main] DEBUG org.hibernate.SQL - insert into Site (name, customerNameAlias, custID, siteID) values (?, ?, ?, ?)
Hibernate: insert into Site (name, customerNameAlias, custID, siteID) values (?, ?, ?, ?)
4857 [main] DEBUG org.hibernate.jdbc.AbstractBatcher - preparing statement
4857 [main] DEBUG org.hibernate.persister.entity.BasicEntityPersister - Dehydrating entity: [customer.Site#1]
4857 [main] DEBUG org.hibernate.type.StringType - binding 'head office' to parameter: 1
4857 [main] DEBUG org.hibernate.type.StringType - binding null to parameter: 2
4857 [main] DEBUG org.hibernate.type.LongType - binding '1' to parameter: 3
4857 [main] DEBUG org.hibernate.type.LongType - binding '1' to parameter: 4
4857 [main] DEBUG org.hibernate.jdbc.AbstractBatcher - Adding to batch
4867 [main] DEBUG org.hibernate.jdbc.AbstractBatcher - Executing batch size: 1
4867 [main] DEBUG org.hibernate.jdbc.AbstractBatcher - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
4867 [main] DEBUG org.hibernate.jdbc.AbstractBatcher - closing statement
4877 [main] DEBUG org.hibernate.persister.collection.AbstractCollectionPersister - Inserting collection: [customer.Customer.flexAtt#1]
4877 [main] DEBUG org.hibernate.persister.collection.AbstractCollectionPersister - collection was empty
4877 [main] DEBUG org.hibernate.event.def.AbstractFlushingEventListener - post flush
4907 [main] DEBUG org.hibernate.impl.SessionImpl - closing session
4907 [main] DEBUG org.hibernate.jdbc.AbstractBatcher - closing JDBC connection (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)
4907 [main] DEBUG org.hibernate.connection.DriverManagerConnectionProvider - returning connection to pool, pool size: 1
4907 [main] DEBUG org.hibernate.jdbc.JDBCContext - after transaction completion
4907 [main] DEBUG org.hibernate.impl.SessionImpl - after transaction completion
4907 [main] DEBUG hibernatedemo.DemoDB - start second set of updates
4907 [main] DEBUG hibernatedemo.DemoDB - add sec Site to cust
4907 [main] DEBUG hibernatedemo.DemoDB - update thrd site with cust ref
4907 [main] DEBUG hibernatedemo.DemoDB - reconnect detattched cust, flush second set of updates
4907 [main] DEBUG org.hibernate.impl.SessionImpl - opened session
4907 [main] DEBUG org.hibernate.event.def.DefaultSaveOrUpdateEventListener - updating detached instance
4917 [main] DEBUG org.hibernate.event.def.DefaultSaveOrUpdateEventListener - updating [customer.Customer#1]
4927 [main] DEBUG org.hibernate.event.def.DefaultSaveOrUpdateEventListener - updating [customer.Customer#1]
4927 [main] DEBUG org.hibernate.engine.Cascades - processing cascade ACTION_SAVE_UPDATE for: customer.Customer
4927 [main] DEBUG org.hibernate.engine.Cascades - cascade ACTION_SAVE_UPDATE for collection: customer.Customer.sites
4927 [main] DEBUG org.hibernate.engine.Cascades - cascading to saveOrUpdate: customer.Site
4927 [main] DEBUG org.hibernate.engine.Cascades - id unsaved-value: 0
4927 [main] DEBUG org.hibernate.event.def.AbstractSaveEventListener - transient instance of: customer.Site
4927 [main] DEBUG org.hibernate.event.def.DefaultSaveOrUpdateEventListener - saving transient instance
4927 [main] DEBUG org.hibernate.event.def.AbstractSaveEventListener - generated identifier: 2, using strategy: org.hibernate.id.IncrementGenerator
4927 [main] DEBUG org.hibernate.event.def.AbstractSaveEventListener - saving [customer.Site#2]
4927 [main] DEBUG org.hibernate.engine.Cascades - processing cascade ACTION_SAVE_UPDATE for: customer.Site
4927 [main] DEBUG org.hibernate.engine.Cascades - cascading to saveOrUpdate: customer.Customer
4927 [main] DEBUG org.hibernate.event.def.AbstractSaveEventListener - persistent instance of: customer.Customer
4927 [main] DEBUG org.hibernate.event.def.DefaultSaveOrUpdateEventListener - ignoring persistent instance
4937 [main] DEBUG org.hibernate.event.def.DefaultSaveOrUpdateEventListener - object already associated with session: [customer.Customer#1]
4937 [main] DEBUG org.hibernate.engine.Cascades - done processing cascade ACTION_SAVE_UPDATE for: customer.Site
4937 [main] DEBUG org.hibernate.engine.Cascades - processing cascade ACTION_SAVE_UPDATE for: customer.Site
4937 [main] DEBUG org.hibernate.engine.Cascades - done processing cascade ACTION_SAVE_UPDATE for: customer.Site
4937 [main] DEBUG org.hibernate.engine.Cascades - cascading to saveOrUpdate: customer.Site
4937 [main] DEBUG org.hibernate.engine.Cascades - id unsaved-value: 0
4937 [main] DEBUG org.hibernate.event.def.AbstractSaveEventListener - detached instance of: customer.Site
4937 [main] DEBUG org.hibernate.event.def.DefaultSaveOrUpdateEventListener - updating detached instance
4937 [main] DEBUG org.hibernate.event.def.DefaultSaveOrUpdateEventListener - updating [customer.Site#1]
4937 [main] DEBUG org.hibernate.event.def.DefaultSaveOrUpdateEventListener - updating [customer.Site#1]
4937 [main] DEBUG org.hibernate.engine.Cascades - processing cascade ACTION_SAVE_UPDATE for: customer.Site
4947 [main] DEBUG org.hibernate.engine.Cascades - cascading to saveOrUpdate: customer.Customer
4947 [main] DEBUG org.hibernate.event.def.AbstractSaveEventListener - persistent instance of: customer.Customer
4947 [main] DEBUG org.hibernate.event.def.DefaultSaveOrUpdateEventListener - ignoring persistent instance
4947 [main] DEBUG org.hibernate.event.def.DefaultSaveOrUpdateEventListener - object already associated with session: [customer.Customer#1]
4947 [main] DEBUG org.hibernate.engine.Cascades - done processing cascade ACTION_SAVE_UPDATE for: customer.Site
4957 [main] DEBUG org.hibernate.engine.Cascades - done cascade ACTION_SAVE_UPDATE for collection: customer.Customer.sites
4957 [main] DEBUG org.hibernate.engine.Cascades - done processing cascade ACTION_SAVE_UPDATE for: customer.Customer
4957 [main] DEBUG org.hibernate.event.def.AbstractFlushingEventListener - flushing session
4957 [main] DEBUG org.hibernate.event.def.AbstractFlushingEventListener - processing flush-time cascades
4957 [main] DEBUG org.hibernate.engine.Cascades - processing cascade ACTION_SAVE_UPDATE for: customer.Customer
4957 [main] DEBUG org.hibernate.engine.Cascades - cascade ACTION_SAVE_UPDATE for collection: customer.Customer.sites
4957 [main] DEBUG org.hibernate.engine.Cascades - cascading to saveOrUpdate: customer.Site
4957 [main] DEBUG org.hibernate.event.def.AbstractSaveEventListener - persistent instance of: customer.Site
4957 [main] DEBUG org.hibernate.event.def.DefaultSaveOrUpdateEventListener - ignoring persistent instance
4957 [main] DEBUG org.hibernate.event.def.DefaultSaveOrUpdateEventListener - object already associated with session: [customer.Site#2]
4957 [main] DEBUG org.hibernate.engine.Cascades - cascading to saveOrUpdate: customer.Site
4957 [main] DEBUG org.hibernate.event.def.AbstractSaveEventListener - persistent instance of: customer.Site
4967 [main] DEBUG org.hibernate.event.def.DefaultSaveOrUpdateEventListener - ignoring persistent instance
4967 [main] DEBUG org.hibernate.event.def.DefaultSaveOrUpdateEventListener - object already associated with session: [customer.Site#1]
4967 [main] DEBUG org.hibernate.engine.Cascades - done cascade ACTION_SAVE_UPDATE for collection: customer.Customer.sites
4967 [main] DEBUG org.hibernate.engine.Cascades - done processing cascade ACTION_SAVE_UPDATE for: customer.Customer
4967 [Finalizer] DEBUG org.hibernate.jdbc.JDBCContext - running Session.finalize()
4967 [main] DEBUG org.hibernate.engine.Cascades - processing cascade ACTION_SAVE_UPDATE for: customer.Site
4967 [main] DEBUG org.hibernate.engine.Cascades - cascading to saveOrUpdate: customer.Customer
4967 [main] DEBUG org.hibernate.event.def.AbstractSaveEventListener - persistent instance of: customer.Customer
4977 [main] DEBUG org.hibernate.event.def.DefaultSaveOrUpdateEventListener - ignoring persistent instance
4977 [main] DEBUG org.hibernate.event.def.DefaultSaveOrUpdateEventListener - object already associated with session: [customer.Customer#1]
4977 [main] DEBUG org.hibernate.engine.Cascades - done processing cascade ACTION_SAVE_UPDATE for: customer.Site
4977 [main] DEBUG org.hibernate.engine.Cascades - processing cascade ACTION_SAVE_UPDATE for: customer.Site
4977 [main] DEBUG org.hibernate.engine.Cascades - cascading to saveOrUpdate: customer.Customer
4977 [main] DEBUG org.hibernate.event.def.AbstractSaveEventListener - persistent instance of: customer.Customer
4987 [main] DEBUG org.hibernate.event.def.DefaultSaveOrUpdateEventListener - ignoring persistent instance
4987 [main] DEBUG org.hibernate.event.def.DefaultSaveOrUpdateEventListener - object already associated with session: [customer.Customer#1]
4987 [main] DEBUG org.hibernate.engine.Cascades - done processing cascade ACTION_SAVE_UPDATE for: customer.Site
4987 [main] DEBUG org.hibernate.event.def.AbstractFlushingEventListener - dirty checking collections
4987 [main] DEBUG org.hibernate.engine.CollectionEntry - Collection dirty: [customer.Customer.sites#1]
4987 [main] DEBUG org.hibernate.event.def.AbstractFlushingEventListener - Flushing entities and processing referenced collections
4997 [main] DEBUG org.hibernate.event.def.DefaultFlushEntityEventListener - Updating entity: [customer.Customer#1]
4997 [main] DEBUG org.hibernate.engine.Versioning - Incrementing: 0 to 1
4997 [main] DEBUG org.hibernate.engine.Collections - Collection found: [customer.Customer.flexAtt#1], was: [customer.Customer.flexAtt#1] (initialized)
4997 [main] DEBUG org.hibernate.engine.Collections - Collection found: [customer.Customer.sites#1], was: [customer.Customer.sites#1] (initialized)
4997 [main] DEBUG org.hibernate.event.def.DefaultFlushEntityEventListener - Updating entity: [customer.Site#1]
4997 [main] DEBUG org.hibernate.event.def.AbstractFlushingEventListener - Processing unreferenced collections
4997 [main] DEBUG org.hibernate.event.def.AbstractFlushingEventListener - Scheduling collection removes/(re)creates/updates
4997 [main] DEBUG org.hibernate.event.def.AbstractFlushingEventListener - Flushed: 1 insertions, 2 updates, 0 deletions to 3 objects
5017 [main] DEBUG org.hibernate.event.def.AbstractFlushingEventListener - Flushed: 0 (re)creations, 1 updates, 0 removals to 2 collections
5017 [main] DEBUG org.hibernate.pretty.Printer - listing entities:
5027 [main] DEBUG org.hibernate.pretty.Printer - customer.Site{siteID=2, customer=customer.Customer#1, customerNameAlias=null, name=local branch}
5027 [main] DEBUG org.hibernate.pretty.Printer - customer.Customer{key=-995319828353405357, flexAtt=[], sites=[customer.Site#2, customer.Site#1], custID=1, name=Reuters, nameAlias=next, version=0}
5027 [main] DEBUG org.hibernate.pretty.Printer - customer.Site{siteID=1, customer=customer.Customer#1, customerNameAlias=null, name=head office}
5027 [main] DEBUG org.hibernate.event.def.AbstractFlushingEventListener - executing flush
5027 [main] DEBUG org.hibernate.persister.entity.BasicEntityPersister - Inserting entity: [customer.Site#2]
5027 [main] DEBUG org.hibernate.jdbc.AbstractBatcher - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
5027 [main] DEBUG org.hibernate.jdbc.AbstractBatcher - opening JDBC connection
5027 [main] DEBUG org.hibernate.connection.DriverManagerConnectionProvider - total checked-out connections: 0
5027 [main] DEBUG org.hibernate.connection.DriverManagerConnectionProvider - using pooled JDBC connection, pool size: 0
5027 [main] DEBUG org.hibernate.SQL - insert into Site (name, customerNameAlias, custID, siteID) values (?, ?, ?, ?)
Hibernate: insert into Site (name, customerNameAlias, custID, siteID) values (?, ?, ?, ?)
5027 [main] DEBUG org.hibernate.jdbc.AbstractBatcher - preparing statement
5037 [main] DEBUG org.hibernate.persister.entity.BasicEntityPersister - Dehydrating entity: [customer.Site#2]
5037 [main] DEBUG org.hibernate.type.StringType - binding 'local branch' to parameter: 1
5037 [main] DEBUG org.hibernate.type.StringType - binding null to parameter: 2
5037 [main] DEBUG org.hibernate.type.LongType - binding '1' to parameter: 3
5037 [main] DEBUG org.hibernate.type.LongType - binding '2' to parameter: 4
5037 [main] DEBUG org.hibernate.jdbc.AbstractBatcher - Adding to batch
5037 [main] DEBUG org.hibernate.jdbc.AbstractBatcher - Executing batch size: 1
5037 [main] DEBUG org.hibernate.jdbc.AbstractBatcher - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
5037 [main] DEBUG org.hibernate.jdbc.AbstractBatcher - closing statement
5047 [main] DEBUG org.hibernate.persister.entity.BasicEntityPersister - Updating entity: [customer.Customer#1]
5047 [main] DEBUG org.hibernate.persister.entity.BasicEntityPersister - Existing version: 0 -> New version: 1
5047 [main] DEBUG org.hibernate.jdbc.AbstractBatcher - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
5047 [main] DEBUG org.hibernate.SQL - update Customer set version=?, uniqueKey=?, custName=?, custNameAlias=? where custID=? and version=?
Hibernate: update Customer set version=?, uniqueKey=?, custName=?, custNameAlias=? where custID=? and version=?
5057 [main] DEBUG org.hibernate.jdbc.AbstractBatcher - preparing statement
5057 [main] DEBUG org.hibernate.persister.entity.BasicEntityPersister - Dehydrating entity: [customer.Customer#1]
5057 [main] DEBUG org.hibernate.type.IntegerType - binding '1' to parameter: 1
5057 [main] DEBUG org.hibernate.type.LongType - binding '-995319828353405357' to parameter: 2
5057 [main] DEBUG org.hibernate.type.StringType - binding 'Reuters' to parameter: 3
5057 [main] DEBUG org.hibernate.type.StringType - binding 'next' to parameter: 4
5057 [main] DEBUG org.hibernate.type.LongType - binding '1' to parameter: 5
5057 [main] DEBUG org.hibernate.type.IntegerType - binding '0' to parameter: 6
5057 [main] DEBUG org.hibernate.jdbc.AbstractBatcher - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
5057 [main] DEBUG org.hibernate.jdbc.AbstractBatcher - closing statement
5067 [main] DEBUG org.hibernate.persister.entity.BasicEntityPersister - Updating entity: [customer.Site#1]
5067 [main] DEBUG org.hibernate.jdbc.AbstractBatcher - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
5067 [main] DEBUG org.hibernate.SQL - update Site set name=?, customerNameAlias=?, custID=? where siteID=?
Hibernate: update Site set name=?, customerNameAlias=?, custID=? where siteID=?
5067 [main] DEBUG org.hibernate.jdbc.AbstractBatcher - preparing statement
5077 [main] DEBUG org.hibernate.persister.entity.BasicEntityPersister - Dehydrating entity: [customer.Site#1]
5077 [main] DEBUG org.hibernate.type.StringType - binding 'head office' to parameter: 1
5077 [main] DEBUG org.hibernate.type.StringType - binding null to parameter: 2
5077 [main] DEBUG org.hibernate.type.LongType - binding '1' to parameter: 3
5077 [main] DEBUG org.hibernate.type.LongType - binding '1' to parameter: 4
5077 [main] DEBUG org.hibernate.jdbc.AbstractBatcher - Adding to batch
5077 [main] DEBUG org.hibernate.jdbc.AbstractBatcher - Executing batch size: 1
5077 [main] DEBUG org.hibernate.jdbc.AbstractBatcher - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
5077 [main] DEBUG org.hibernate.jdbc.AbstractBatcher - closing statement
5077 [main] DEBUG org.hibernate.event.def.AbstractFlushingEventListener - post flush
5077 [main] DEBUG org.hibernate.event.def.AbstractFlushingEventListener - flushing session
5077 [main] DEBUG org.hibernate.event.def.AbstractFlushingEventListener - processing flush-time cascades
5087 [main] DEBUG org.hibernate.engine.Cascades - processing cascade ACTION_SAVE_UPDATE for: customer.Customer
5087 [main] DEBUG org.hibernate.engine.Cascades - cascade ACTION_SAVE_UPDATE for collection: customer.Customer.sites
5087 [main] DEBUG org.hibernate.engine.Cascades - cascading to saveOrUpdate: customer.Site
5087 [main] DEBUG org.hibernate.event.def.AbstractSaveEventListener - persistent instance of: customer.Site
5087 [main] DEBUG org.hibernate.event.def.DefaultSaveOrUpdateEventListener - ignoring persistent instance
5087 [main] DEBUG org.hibernate.event.def.DefaultSaveOrUpdateEventListener - object already associated with session: [customer.Site#2]
5087 [main] DEBUG org.hibernate.engine.Cascades - cascading to saveOrUpdate: customer.Site
5087 [main] DEBUG org.hibernate.event.def.AbstractSaveEventListener - persistent instance of: customer.Site
5087 [main] DEBUG org.hibernate.event.def.DefaultSaveOrUpdateEventListener - ignoring persistent instance
5087 [main] DEBUG org.hibernate.event.def.DefaultSaveOrUpdateEventListener - object already associated with session: [customer.Site#1]
5087 [main] DEBUG org.hibernate.engine.Cascades - done cascade ACTION_SAVE_UPDATE for collection: customer.Customer.sites
5087 [main] DEBUG org.hibernate.engine.Cascades - done processing cascade ACTION_SAVE_UPDATE for: customer.Customer
5087 [main] DEBUG org.hibernate.engine.Cascades - processing cascade ACTION_SAVE_UPDATE for: customer.Site
5087 [main] DEBUG org.hibernate.engine.Cascades - cascading to saveOrUpdate: customer.Customer
5097 [main] DEBUG org.hibernate.event.def.AbstractSaveEventListener - persistent instance of: customer.Customer
5097 [main] DEBUG org.hibernate.event.def.DefaultSaveOrUpdateEventListener - ignoring persistent instance
5097 [main] DEBUG org.hibernate.event.def.DefaultSaveOrUpdateEventListener - object already associated with session: [customer.Customer#1]
5097 [main] DEBUG org.hibernate.engine.Cascades - done processing cascade ACTION_SAVE_UPDATE for: customer.Site
5107 [main] DEBUG org.hibernate.engine.Cascades - processing cascade ACTION_SAVE_UPDATE for: customer.Site
5107 [main] DEBUG org.hibernate.engine.Cascades - cascading to saveOrUpdate: customer.Customer
5107 [main] DEBUG org.hibernate.event.def.AbstractSaveEventListener - persistent instance of: customer.Customer
5107 [main] DEBUG org.hibernate.event.def.DefaultSaveOrUpdateEventListener - ignoring persistent instance
5107 [main] DEBUG org.hibernate.event.def.DefaultSaveOrUpdateEventListener - object already associated with session: [customer.Customer#1]
5107 [main] DEBUG org.hibernate.engine.Cascades - done processing cascade ACTION_SAVE_UPDATE for: customer.Site
5107 [main] DEBUG org.hibernate.event.def.AbstractFlushingEventListener - dirty checking collections
5107 [main] DEBUG org.hibernate.event.def.AbstractFlushingEventListener - Flushing entities and processing referenced collections
5107 [main] DEBUG org.hibernate.engine.Collections - Collection found: [customer.Customer.flexAtt#1], was: [customer.Customer.flexAtt#1] (initialized)
5107 [main] DEBUG org.hibernate.engine.Collections - Collection found: [customer.Customer.sites#1], was: [customer.Customer.sites#1] (initialized)
5117 [main] DEBUG org.hibernate.event.def.AbstractFlushingEventListener - Processing unreferenced collections
5117 [main] DEBUG org.hibernate.event.def.AbstractFlushingEventListener - Scheduling collection removes/(re)creates/updates
5117 [main] DEBUG org.hibernate.event.def.AbstractFlushingEventListener - Flushed: 0 insertions, 0 updates, 0 deletions to 3 objects
5117 [main] DEBUG org.hibernate.event.def.AbstractFlushingEventListener - Flushed: 0 (re)creations, 0 updates, 0 removals to 2 collections
5127 [main] DEBUG org.hibernate.pretty.Printer - listing entities:
5138 [main] DEBUG org.hibernate.pretty.Printer - customer.Site{siteID=2, customer=customer.Customer#1, customerNameAlias=null, name=local branch}
5138 [main] DEBUG org.hibernate.pretty.Printer - customer.Customer{key=-995319828353405357, flexAtt=[], sites=[customer.Site#2, customer.Site#1], custID=1, name=Reuters, nameAlias=next, version=1}
5138 [main] DEBUG org.hibernate.pretty.Printer - customer.Site{siteID=1, customer=customer.Customer#1, customerNameAlias=null, name=head office}
5138 [main] DEBUG org.hibernate.event.def.AbstractFlushingEventListener - executing flush
5138 [main] DEBUG org.hibernate.event.def.AbstractFlushingEventListener - post flush
5158 [main] DEBUG org.hibernate.impl.SessionImpl - closing session
5158 [main] DEBUG org.hibernate.jdbc.AbstractBatcher - closing JDBC connection (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)
5158 [main] DEBUG org.hibernate.connection.DriverManagerConnectionProvider - returning connection to pool, pool size: 1
5158 [main] DEBUG org.hibernate.jdbc.JDBCContext - after transaction completion
5158 [main] DEBUG org.hibernate.impl.SessionImpl - after transaction completion

[/code]


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 08, 2005 11:38 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
Well the session never knows about your thrdSite reference. You reattach a customer; but the customer object *does not* know about the thrdSite (only the thrdSite knows about the customer).


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 08, 2005 2:03 pm 
Newbie

Joined: Fri Mar 04, 2005 7:10 am
Posts: 12
okay i can buy that I guess,

so the only way to persist is either to add a transient record to a persisted entity and allow the cascade functionality to trigger,

or declare the transient object and persist it via the session before manipulating it with other records ( I think this is what you've said)

on that basis given the example i was working with, if i declare the thrdSite, and set its customer id to the session and persist it, does this automatically update the SET reference in the customer object because I updated the many side of the relationship? or do I still have to update the customer sites attribute with the record I just persisted? Does the cascade work from the many side to the single?

thanks for your observation Will


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 08, 2005 4:59 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
Quote:
does this automatically update the SET reference in the customer object because I updated the many side of the relationship?

No. Hibernate does not implement CMR. You need to manage both sides of a bi-directional association. Normal java semantics apply here.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.