-->
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.  [ 2 posts ] 
Author Message
 Post subject: trans. java.lang.ClassCastException - complete info supplied
PostPosted: Tue May 24, 2005 6:44 am 
Senior
Senior

Joined: Fri Jun 18, 2004 10:17 am
Posts: 140
Hello!

I've got 2 objects in my database, both added via Hibernate (so something works here). A Page and an Asset.

It was all going so well, but now I am trying to get the link between the 2 existing objects to be inserted into the link table that is currently empty.

I want to do it this way because an Asset should be able to be associated with any Page at any time, not just when the Asset is created.

I figured as a test, I should be able to load my Page instance individually, theb my Asset, and then bind the asset into the page and save.

I do this with some scaffold code

Code:
   public void addAsset(Asset asset) {
      if (asset == null) {
         throw new IllegalArgumentException("Null Asset.");
      }
      
   
      asset.getPages().add(this);
      assets.add(asset);
   }


However, I am getting a ClassCastException on Page for some reason and nowhere in my thousands of logs can I spot why this may be happening. Usually (and I hope in this case) I have done something basically silly but need help finding out where. I certainly can't see a readon why a ClassCastE is happening, I've checked my references. (he says)

Hibernate version:

3.0

Mapping documents:

Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
        "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
        "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<!--  -->

<hibernate-mapping
   schema="dbWeb.dbo"
   default-cascade="none"
   default-access="property"
   default-lazy="true"
   auto-import="true"
   package="com.qas.newmedia.internet.core.page.model">   
   

    <class
       name="Page"
      table="tblPages"
      lazy="false">

        <id
           name="id"
           type="int"
           column="page_id"
           unsaved-value="0">
           
           <generator class="identity" />
       </id> 
            
      <property
         name="peerPosition"
         column="peer_pos"
         type="int"
         not-null="true"
      />
      
      <property
         name="nameId"
         column="name_id"
         type="string"
         not-null="true"
      />
      
        <property
           name="created"
           column="created"
           type="calendar"
           not-null="true"
        />
        
        <property
           name="site"
           column="site"
           type="string"
           not-null="true"
        />
        
        <property
           name="path"
           column="path"
           type="string"
           not-null="true"
        />
        
        <property
           name="country"
           column="country"
           type="string"
           not-null="true"
        />
        
        <property
           name="language"
           column="language"
           type="string"
           not-null="true"
        />
        
        <property
           name="templateId"
           column="template_id"
           type="string"
           not-null="true"
        />
        
        <property
           name="title"
           column="title"
           type="string"
           not-null="true"
        />
        
        <property
           name="description"
           column="description"
           type="string"
           not-null="true"
        />
        
        <property
           name="keywords"
           column="keywords"
           type="string"
           not-null="true"
        />
        
        <property
           name="noIndex"
           column="no_index"
           type="boolean"
           not-null="true"
        />
        
        <property
           name="enabled"
           column="enabled"
           type="boolean"
           not-null="true"
        />
   
      <property
         name="permanentRedirectUrl"
         column="perm_red_url"
         type="string"
         not-null="false"
      />
      
      <property
         name="permanentRedirectDate"
         column="perm_red_date"
         type="string"
         not-null="false"
      />
      
      <property
         name="pnsLabel"
         column="pns_label"
         type="string"
         not-null="true"
      />
      
      <property
         name="bnsLabel"
         column="bns_label"
         type="string"
         not-null="true"
      />
      
      <property
         name="snsLabel"
         column="sns_label"
         type="string"
         not-null="false"
      />
      
      <property
         name="fnsLabel"
         column="fns_label"
         type="string"
         not-null="false"
      />   
      
      <many-to-one
         name="parentPage"
         class="Page"
         column="parent_page_id"
         cascade="none"
      />
      
      <set
         name="childPages"
         table="tblPages"
         cascade="save-update"
         lazy="false"
         inverse="true">
         
         <key column="parent_page_id" />
         <one-to-many class="Page" />
      </set>
      
      <list
         name="assets" 
         table="tblPageAssets"
         lazy="false"
         cascade="save-update">
           
            <key
               column="page_id"
               not-null="true"
            />

            <index column="peer_pos" />
           
            <many-to-many
               class="Asset"
               column="asset_id" />
        </list>

    </class>
   
</hibernate-mapping>


Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
        "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
        "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping
   schema="dbWeb.dbo"
   default-cascade="none"
   default-access="property"
   default-lazy="true"
   auto-import="true"
   package="com.qas.newmedia.internet.core.page.model">

   <class
      name="Asset"
      table="tblAssets"
      lazy="false">

        <id name="id" type="int" column="asset_id" unsaved-value="0">
           <generator class="identity" />
       </id>

      <property name="nameId" column="name_id" type="string" not-null="true" />
        <property name="status" column="status" type="char" not-null="true" />
        <property name="created" column="created" type="calendar" not-null="true" />
        <property name="released" column="released" type="calendar" not-null="false" />
        <property name="expiry" column="expiry" type="calendar" not-null="false" />
      <property name="version" column="version" type="int" not-null="true" />
      <property name="type" column="type" type="string" not-null="false" />
      <property name="file" column="filename" type="string" not-null="false" />
      <property name="ext" column="ext" type="string" not-null="false" />
      <property name="uiType" column="ui_type" type="string" not-null="false" />

      <set name="pages"
         table="tblPageAssets"
         lazy="false"
         inverse="true"
         cascade="save-update">
         
         <key column="asset_id" />
         
         <many-to-many
            class="Asset"
            column="page_id"
         />
      </set>
      
   </class>
   
</hibernate-mapping>


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

Code:
      Page page = (Page) getHibernateTemplate().load(Page.class, 1);
      
      if (page == null) {
         throw new RuntimeException("Could not find Page");
      }

      Asset asset = (Asset) getHibernateTemplate().load(Asset.class, 1);
      
      if (asset == null) {
         throw new RuntimeException("Could not find Asset");
      }
      
      page.addAsset(asset);
      
      logger.debug("try and save");
      
      getHibernateTemplate().saveOrUpdate(asset);
      //getHibernateTemplate().saveOrUpdate(page);


Full stack trace of any exception that occurs:

Code:
java.lang.ClassCastException: com.qas.newmedia.internet.core.page.model.Page
   org.hibernate.type.EntityType.toLoggableString(EntityType.java:134)
   org.hibernate.type.CollectionType.toLoggableString(CollectionType.java:142)
   org.hibernate.pretty.Printer.toString(Printer.java:53)
   org.hibernate.pretty.Printer.toString(Printer.java:90)
   org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:91)
   org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:26)
   org.hibernate.impl.SessionImpl.flush(SessionImpl.java:669)
   org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:293)
   org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:86)
   org.springframework.orm.hibernate3.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:484)
   org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:401)
   org.springframework.transaction.interceptor.TransactionAspectSupport.doCommitTransactionAfterReturning(TransactionAspectSupport.java:258)
   org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:67)
   org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:144)
   org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:174)
   $Proxy0.addAssetToPage(Unknown Source)
   com.qas.newmedia.internet.core.admin.action.AssetToPageAction.execute(AssetToPageAction.java:45)
   org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:421)
   org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:226)
   org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
   org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:397)
   javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
   javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


Name and version of the database you are using:

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:

Code:
2005-05-24 11:35:36,736 - DEBUG (org.hibernate.impl.SessionImpl:229) - opened session
2005-05-24 11:35:36,736 - DEBUG (org.hibernate.jdbc.AbstractBatcher:379) - opening JDBC connection
2005-05-24 11:35:36,736 - DEBUG (org.hibernate.transaction.JDBCTransaction:46) - begin
2005-05-24 11:35:36,736 - DEBUG (org.hibernate.transaction.JDBCTransaction:50) - current autocommit status: true
2005-05-24 11:35:36,751 - DEBUG (org.hibernate.transaction.JDBCTransaction:52) - disabling autocommit
2005-05-24 11:35:36,767 - DEBUG (org.hibernate.event.def.DefaultLoadEventListener:193) - loading entity: [com.qas.newmedia.internet.core.page.model.Page#1]
2005-05-24 11:35:36,767 - DEBUG (org.hibernate.event.def.DefaultLoadEventListener:326) - attempting to resolve: [com.qas.newmedia.internet.core.page.model.Page#1]
2005-05-24 11:35:36,767 - DEBUG (org.hibernate.event.def.DefaultLoadEventListener:362) - object not resolved in any cache: [com.qas.newmedia.internet.core.page.model.Page#1]
2005-05-24 11:35:36,767 - DEBUG (org.hibernate.persister.entity.BasicEntityPersister:2449) - Materializing entity: [com.qas.newmedia.internet.core.page.model.Page#1]
2005-05-24 11:35:36,767 - DEBUG (org.hibernate.loader.Loader:1250) - loading entity: [com.qas.newmedia.internet.core.page.model.Page#1]
2005-05-24 11:35:36,783 - DEBUG (org.hibernate.jdbc.AbstractBatcher:258) - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
2005-05-24 11:35:36,783 - DEBUG (org.hibernate.jdbc.AbstractBatcher:292) - select page0_.page_id as page1_1_, page0_.peer_pos as peer2_0_1_, page0_.name_id as name3_0_1_, page0_.created as created0_1_, page0_.site as site0_1_, page0_.path as path0_1_, page0_.country as country0_1_, page0_.language as language0_1_, page0_.template_id as template9_0_1_, page0_.title as title0_1_, page0_.description as descrip11_0_1_, page0_.keywords as keywords0_1_, page0_.no_index as no13_0_1_, page0_.enabled as enabled0_1_, page0_.perm_red_url as perm15_0_1_, page0_.perm_red_date as perm16_0_1_, page0_.pns_label as pns17_0_1_, page0_.bns_label as bns18_0_1_, page0_.sns_label as sns19_0_1_, page0_.fns_label as fns20_0_1_, page0_.parent_page_id as parent21_0_1_, page1_.page_id as page1_0_, page1_.peer_pos as peer2_0_0_, page1_.name_id as name3_0_0_, page1_.created as created0_0_, page1_.site as site0_0_, page1_.path as path0_0_, page1_.country as country0_0_, page1_.language as language0_0_, page1_.template_id as template9_0_0_, page1_.title as title0_0_, page1_.description as descrip11_0_0_, page1_.keywords as keywords0_0_, page1_.no_index as no13_0_0_, page1_.enabled as enabled0_0_, page1_.perm_red_url as perm15_0_0_, page1_.perm_red_date as perm16_0_0_, page1_.pns_label as pns17_0_0_, page1_.bns_label as bns18_0_0_, page1_.sns_label as sns19_0_0_, page1_.fns_label as fns20_0_0_, page1_.parent_page_id as parent21_0_0_ from dbWeb.dbo.tblPages page0_ left outer join dbWeb.dbo.tblPages page1_ on page0_.parent_page_id=page1_.page_id where page0_.page_id=?
2005-05-24 11:35:36,783 - DEBUG (org.hibernate.jdbc.AbstractBatcher:343) - preparing statement
2005-05-24 11:35:36,798 - DEBUG (org.hibernate.type.NullableType:59) - binding '1' to parameter: 1
2005-05-24 11:35:36,829 - DEBUG (org.hibernate.jdbc.AbstractBatcher:274) - about to open ResultSet (open ResultSets: 0, globally: 0)
2005-05-24 11:35:36,829 - DEBUG (org.hibernate.loader.Loader:377) - processing result set
2005-05-24 11:35:36,829 - DEBUG (org.hibernate.loader.Loader:382) - result set row: 0
2005-05-24 11:35:36,829 - DEBUG (org.hibernate.type.NullableType:80) - returning null as column: page1_0_
2005-05-24 11:35:36,829 - DEBUG (org.hibernate.loader.Loader:719) - result row: null, EntityKey[com.qas.newmedia.internet.core.page.model.Page#1]
2005-05-24 11:35:36,829 - DEBUG (org.hibernate.loader.Loader:864) - Initializing object from ResultSet: [com.qas.newmedia.internet.core.page.model.Page#1]
2005-05-24 11:35:36,845 - DEBUG (org.hibernate.persister.entity.BasicEntityPersister:1625) - Hydrating entity: [com.qas.newmedia.internet.core.page.model.Page#1]
2005-05-24 11:35:36,845 - DEBUG (org.hibernate.type.NullableType:86) - returning '0' as column: peer2_0_1_
2005-05-24 11:35:36,845 - DEBUG (org.hibernate.type.NullableType:86) - returning 'test' as column: name3_0_1_
2005-05-24 11:35:36,845 - DEBUG (org.hibernate.type.NullableType:86) - returning '2005-05-24 11:24:50' as column: created0_1_
2005-05-24 11:35:36,845 - DEBUG (org.hibernate.type.NullableType:86) - returning 'localhost' as column: site0_1_
2005-05-24 11:35:36,845 - DEBUG (org.hibernate.type.NullableType:86) - returning '/page' as column: path0_1_
2005-05-24 11:35:36,861 - DEBUG (org.hibernate.type.NullableType:86) - returning 'GB' as column: country0_1_
2005-05-24 11:35:36,861 - DEBUG (org.hibernate.type.NullableType:86) - returning 'en' as column: language0_1_
2005-05-24 11:35:36,861 - DEBUG (org.hibernate.type.NullableType:86) - returning 'microsite' as column: template9_0_1_
2005-05-24 11:35:36,861 - DEBUG (org.hibernate.type.NullableType:86) - returning 'F-Zero' as column: title0_1_
2005-05-24 11:35:36,861 - DEBUG (org.hibernate.type.NullableType:86) - returning 'Classic retro-gaming!' as column: descrip11_0_1_
2005-05-24 11:35:36,861 - DEBUG (org.hibernate.type.NullableType:86) - returning 'nintendo, retro, gaming' as column: keywords0_1_
2005-05-24 11:35:36,861 - DEBUG (org.hibernate.type.NullableType:86) - returning 'true' as column: no13_0_1_
2005-05-24 11:35:36,861 - DEBUG (org.hibernate.type.NullableType:86) - returning 'true' as column: enabled0_1_
2005-05-24 11:35:36,861 - DEBUG (org.hibernate.type.NullableType:80) - returning null as column: perm15_0_1_
2005-05-24 11:35:36,861 - DEBUG (org.hibernate.type.NullableType:80) - returning null as column: perm16_0_1_
2005-05-24 11:35:36,861 - DEBUG (org.hibernate.type.NullableType:86) - returning 'F-Zero PNS' as column: pns17_0_1_
2005-05-24 11:35:36,876 - DEBUG (org.hibernate.type.NullableType:86) - returning 'F-Zero BNS' as column: bns18_0_1_
2005-05-24 11:35:36,876 - DEBUG (org.hibernate.type.NullableType:86) - returning 'F-Zero SNS' as column: sns19_0_1_
2005-05-24 11:35:36,876 - DEBUG (org.hibernate.type.NullableType:86) - returning 'F-Zero FNS' as column: fns20_0_1_
2005-05-24 11:35:36,876 - DEBUG (org.hibernate.type.NullableType:80) - returning null as column: parent21_0_1_
2005-05-24 11:35:36,876 - DEBUG (org.hibernate.loader.Loader:399) - done processing result set (1 rows)
2005-05-24 11:35:36,876 - DEBUG (org.hibernate.jdbc.AbstractBatcher:281) - about to close ResultSet (open ResultSets: 1, globally: 1)
2005-05-24 11:35:36,876 - DEBUG (org.hibernate.jdbc.AbstractBatcher:266) - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
2005-05-24 11:35:36,876 - DEBUG (org.hibernate.jdbc.AbstractBatcher:363) - closing statement
2005-05-24 11:35:36,892 - DEBUG (org.hibernate.loader.Loader:450) - total objects hydrated: 1
2005-05-24 11:35:36,892 - DEBUG (org.hibernate.engine.TwoPhaseLoad:96) - resolving associations for [com.qas.newmedia.internet.core.page.model.Page#1]

2005-05-24 11:35:36,908 - DEBUG (org.hibernate.engine.CollectionLoadContext:134) - creating collection wrapper:[com.qas.newmedia.internet.core.page.model.Page.childPages#1]
2005-05-24 11:35:36,908 - DEBUG (org.hibernate.engine.CollectionLoadContext:134) - creating collection wrapper:[com.qas.newmedia.internet.core.page.model.Page.assets#1]
2005-05-24 11:35:36,923 - DEBUG (org.hibernate.engine.TwoPhaseLoad:167) - done materializing entity [com.qas.newmedia.internet.core.page.model.Page#1]
2005-05-24 11:35:36,923 - DEBUG (org.hibernate.engine.PersistenceContext:738) - initializing non-lazy collections
2005-05-24 11:35:36,923 - DEBUG (org.hibernate.event.def.DefaultInitializeCollectionEventListener:42) - initializing collection [com.qas.newmedia.internet.core.page.model.Page.assets#1]
2005-05-24 11:35:36,923 - DEBUG (org.hibernate.event.def.DefaultInitializeCollectionEventListener:47) - checking second-level cache
2005-05-24 11:35:36,923 - DEBUG (org.hibernate.event.def.DefaultInitializeCollectionEventListener:59) - collection not cached
2005-05-24 11:35:36,923 - DEBUG (org.hibernate.loader.Loader:1336) - batch loading collection: [com.qas.newmedia.internet.core.page.model.Page.assets#1]
2005-05-24 11:35:36,923 - DEBUG (org.hibernate.jdbc.AbstractBatcher:258) - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
2005-05-24 11:35:36,923 - DEBUG (org.hibernate.jdbc.AbstractBatcher:292) - select assets0_.page_id as page1___, assets0_.asset_id as asset2___, assets0_.peer_pos as peer3___, asset1_.asset_id as asset1_0_, asset1_.name_id as name2_2_0_, asset1_.status as status2_0_, asset1_.created as created2_0_, asset1_.released as released2_0_, asset1_.expiry as expiry2_0_, asset1_.version as version2_0_, asset1_.type as type2_0_, asset1_.filename as filename2_0_, asset1_.ext as ext2_0_, asset1_.ui_type as ui11_2_0_ from dbWeb.dbo.tblPageAssets assets0_ inner join dbWeb.dbo.tblAssets asset1_ on assets0_.asset_id=asset1_.asset_id where assets0_.page_id=?
2005-05-24 11:35:36,923 - DEBUG (org.hibernate.jdbc.AbstractBatcher:343) - preparing statement
2005-05-24 11:35:36,939 - DEBUG (org.hibernate.type.NullableType:59) - binding '1' to parameter: 1
2005-05-24 11:35:36,939 - DEBUG (org.hibernate.jdbc.AbstractBatcher:274) - about to open ResultSet (open ResultSets: 0, globally: 0)
2005-05-24 11:35:36,939 - DEBUG (org.hibernate.loader.Loader:610) - result set contains (possibly empty) collection: [com.qas.newmedia.internet.core.page.model.Page.assets#1]
2005-05-24 11:35:36,954 - DEBUG (org.hibernate.engine.CollectionLoadContext:78) - uninitialized collection: initializing
2005-05-24 11:35:36,954 - DEBUG (org.hibernate.loader.Loader:377) - processing result set
2005-05-24 11:35:36,954 - DEBUG (org.hibernate.loader.Loader:399) - done processing result set (0 rows)
2005-05-24 11:35:36,954 - DEBUG (org.hibernate.jdbc.AbstractBatcher:281) - about to close ResultSet (open ResultSets: 1, globally: 1)
2005-05-24 11:35:36,954 - DEBUG (org.hibernate.jdbc.AbstractBatcher:266) - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
2005-05-24 11:35:36,954 - DEBUG (org.hibernate.jdbc.AbstractBatcher:363) - closing statement
2005-05-24 11:35:36,954 - DEBUG (org.hibernate.loader.Loader:450) - total objects hydrated: 0
2005-05-24 11:35:36,954 - DEBUG (org.hibernate.engine.CollectionLoadContext:239) - 1 collections were found in result set
2005-05-24 11:35:36,954 - DEBUG (org.hibernate.engine.CollectionLoadContext:193) - collection fully initialized: [com.qas.newmedia.internet.core.page.model.Page.assets#1]
2005-05-24 11:35:36,954 - DEBUG (org.hibernate.engine.CollectionLoadContext:247) - 1 collections initialized
2005-05-24 11:35:36,954 - DEBUG (org.hibernate.loader.Loader:1360) - done loading collection
2005-05-24 11:35:36,954 - DEBUG (org.hibernate.event.def.DefaultInitializeCollectionEventListener:61) - collection initialized
2005-05-24 11:35:36,954 - DEBUG (org.hibernate.event.def.DefaultInitializeCollectionEventListener:42) - initializing collection [com.qas.newmedia.internet.core.page.model.Page.childPages#1]
2005-05-24 11:35:36,954 - DEBUG (org.hibernate.event.def.DefaultInitializeCollectionEventListener:47) - checking second-level cache
2005-05-24 11:35:36,954 - DEBUG (org.hibernate.event.def.DefaultInitializeCollectionEventListener:59) - collection not cached
2005-05-24 11:35:36,970 - DEBUG (org.hibernate.loader.Loader:1336) - batch loading collection: [com.qas.newmedia.internet.core.page.model.Page.childPages#1]
2005-05-24 11:35:36,970 - DEBUG (org.hibernate.jdbc.AbstractBatcher:258) - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
2005-05-24 11:35:36,970 - DEBUG (org.hibernate.jdbc.AbstractBatcher:292) - select childpages0_.parent_page_id as parent21___, childpages0_.page_id as page1___, childpages0_.page_id as page1_0_, childpages0_.peer_pos as peer2_0_0_, childpages0_.name_id as name3_0_0_, childpages0_.created as created0_0_, childpages0_.site as site0_0_, childpages0_.path as path0_0_, childpages0_.country as country0_0_, childpages0_.language as language0_0_, childpages0_.template_id as template9_0_0_, childpages0_.title as title0_0_, childpages0_.description as descrip11_0_0_, childpages0_.keywords as keywords0_0_, childpages0_.no_index as no13_0_0_, childpages0_.enabled as enabled0_0_, childpages0_.perm_red_url as perm15_0_0_, childpages0_.perm_red_date as perm16_0_0_, childpages0_.pns_label as pns17_0_0_, childpages0_.bns_label as bns18_0_0_, childpages0_.sns_label as sns19_0_0_, childpages0_.fns_label as fns20_0_0_, childpages0_.parent_page_id as parent21_0_0_ from dbWeb.dbo.tblPages childpages0_ where childpages0_.parent_page_id=?
2005-05-24 11:35:36,970 - DEBUG (org.hibernate.jdbc.AbstractBatcher:343) - preparing statement
2005-05-24 11:35:36,970 - DEBUG (org.hibernate.type.NullableType:59) - binding '1' to parameter: 1
2005-05-24 11:35:36,970 - DEBUG (org.hibernate.jdbc.AbstractBatcher:274) - about to open ResultSet (open ResultSets: 0, globally: 0)
2005-05-24 11:35:36,970 - DEBUG (org.hibernate.loader.Loader:610) - result set contains (possibly empty) collection: [com.qas.newmedia.internet.core.page.model.Page.childPages#1]
2005-05-24 11:35:36,970 - DEBUG (org.hibernate.engine.CollectionLoadContext:78) - uninitialized collection: initializing
2005-05-24 11:35:36,970 - DEBUG (org.hibernate.loader.Loader:377) - processing result set
2005-05-24 11:35:36,986 - DEBUG (org.hibernate.loader.Loader:399) - done processing result set (0 rows)
2005-05-24 11:35:36,986 - DEBUG (org.hibernate.jdbc.AbstractBatcher:281) - about to close ResultSet (open ResultSets: 1, globally: 1)
2005-05-24 11:35:36,986 - DEBUG (org.hibernate.jdbc.AbstractBatcher:266) - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
2005-05-24 11:35:36,986 - DEBUG (org.hibernate.jdbc.AbstractBatcher:363) - closing statement
2005-05-24 11:35:36,986 - DEBUG (org.hibernate.loader.Loader:450) - total objects hydrated: 0
2005-05-24 11:35:36,986 - DEBUG (org.hibernate.engine.CollectionLoadContext:239) - 1 collections were found in result set
2005-05-24 11:35:36,986 - DEBUG (org.hibernate.engine.CollectionLoadContext:193) - collection fully initialized: [com.qas.newmedia.internet.core.page.model.Page.childPages#1]
2005-05-24 11:35:36,986 - DEBUG (org.hibernate.engine.CollectionLoadContext:247) - 1 collections initialized
2005-05-24 11:35:36,986 - DEBUG (org.hibernate.loader.Loader:1360) - done loading collection
2005-05-24 11:35:36,986 - DEBUG (org.hibernate.event.def.DefaultInitializeCollectionEventListener:61) - collection initialized
2005-05-24 11:35:36,986 - DEBUG (org.hibernate.loader.Loader:1278) - done entity load
2005-05-24 11:35:36,986 - DEBUG (org.hibernate.event.def.DefaultLoadEventListener:193) - loading entity: [com.qas.newmedia.internet.core.page.model.Asset#1]
2005-05-24 11:35:37,001 - DEBUG (org.hibernate.event.def.DefaultLoadEventListener:326) - attempting to resolve: [com.qas.newmedia.internet.core.page.model.Asset#1]
2005-05-24 11:35:37,001 - DEBUG (org.hibernate.event.def.DefaultLoadEventListener:362) - object not resolved in any cache: [com.qas.newmedia.internet.core.page.model.Asset#1]
2005-05-24 11:35:37,001 - DEBUG (org.hibernate.persister.entity.BasicEntityPersister:2449) - Materializing entity: [com.qas.newmedia.internet.core.page.model.Asset#1]
2005-05-24 11:35:37,001 - DEBUG (org.hibernate.loader.Loader:1250) - loading entity: [com.qas.newmedia.internet.core.page.model.Asset#1]
2005-05-24 11:35:37,001 - DEBUG (org.hibernate.jdbc.AbstractBatcher:258) - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
2005-05-24 11:35:37,001 - DEBUG (org.hibernate.jdbc.AbstractBatcher:292) - select asset0_.asset_id as asset1_0_, asset0_.name_id as name2_2_0_, asset0_.status as status2_0_, asset0_.created as created2_0_, asset0_.released as released2_0_, asset0_.expiry as expiry2_0_, asset0_.version as version2_0_, asset0_.type as type2_0_, asset0_.filename as filename2_0_, asset0_.ext as ext2_0_, asset0_.ui_type as ui11_2_0_ from dbWeb.dbo.tblAssets asset0_ where asset0_.asset_id=?
2005-05-24 11:35:37,001 - DEBUG (org.hibernate.jdbc.AbstractBatcher:343) - preparing statement
2005-05-24 11:35:37,001 - DEBUG (org.hibernate.type.NullableType:59) - binding '1' to parameter: 1
2005-05-24 11:35:37,001 - DEBUG (org.hibernate.jdbc.AbstractBatcher:274) - about to open ResultSet (open ResultSets: 0, globally: 0)
2005-05-24 11:35:37,001 - DEBUG (org.hibernate.loader.Loader:377) - processing result set
2005-05-24 11:35:37,001 - DEBUG (org.hibernate.loader.Loader:382) - result set row: 0
2005-05-24 11:35:37,001 - DEBUG (org.hibernate.loader.Loader:719) - result row: EntityKey[com.qas.newmedia.internet.core.page.model.Asset#1]
2005-05-24 11:35:37,017 - DEBUG (org.hibernate.loader.Loader:864) - Initializing object from ResultSet: [com.qas.newmedia.internet.core.page.model.Asset#1]
2005-05-24 11:35:37,017 - DEBUG (org.hibernate.persister.entity.BasicEntityPersister:1625) - Hydrating entity: [com.qas.newmedia.internet.core.page.model.Asset#1]
2005-05-24 11:35:37,017 - DEBUG (org.hibernate.type.NullableType:86) - returning 'test' as column: name2_2_0_
2005-05-24 11:35:37,017 - DEBUG (org.hibernate.type.NullableType:86) - returning 'R' as column: status2_0_
2005-05-24 11:35:37,017 - DEBUG (org.hibernate.type.NullableType:86) - returning '2005-05-24 11:24:40' as column: created2_0_
2005-05-24 11:35:37,017 - DEBUG (org.hibernate.type.NullableType:86) - returning '2005-05-24 11:24:40' as column: released2_0_
2005-05-24 11:35:37,017 - DEBUG (org.hibernate.type.NullableType:86) - returning '2005-05-24 11:24:40' as column: expiry2_0_
2005-05-24 11:35:37,017 - DEBUG (org.hibernate.type.NullableType:86) - returning '1' as column: version2_0_
2005-05-24 11:35:37,017 - DEBUG (org.hibernate.type.NullableType:86) - returning 'News' as column: type2_0_
2005-05-24 11:35:37,017 - DEBUG (org.hibernate.type.NullableType:86) - returning 'F-Zero' as column: filename2_0_
2005-05-24 11:35:37,017 - DEBUG (org.hibernate.type.NullableType:86) - returning 'htm' as column: ext2_0_
2005-05-24 11:35:37,017 - DEBUG (org.hibernate.type.NullableType:86) - returning 'LEFT' as column: ui11_2_0_
2005-05-24 11:35:37,017 - DEBUG (org.hibernate.loader.Loader:399) - done processing result set (1 rows)
2005-05-24 11:35:37,017 - DEBUG (org.hibernate.jdbc.AbstractBatcher:281) - about to close ResultSet (open ResultSets: 1, globally: 1)
2005-05-24 11:35:37,017 - DEBUG (org.hibernate.jdbc.AbstractBatcher:266) - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
2005-05-24 11:35:37,017 - DEBUG (org.hibernate.jdbc.AbstractBatcher:363) - closing statement
2005-05-24 11:35:37,033 - DEBUG (org.hibernate.loader.Loader:450) - total objects hydrated: 1
2005-05-24 11:35:37,033 - DEBUG (org.hibernate.engine.TwoPhaseLoad:96) - resolving associations for [com.qas.newmedia.internet.core.page.model.Asset#1]
2005-05-24 11:35:37,033 - DEBUG (org.hibernate.engine.CollectionLoadContext:134) - creating collection wrapper:[com.qas.newmedia.internet.core.page.model.Asset.pages#1]
2005-05-24 11:35:37,033 - DEBUG (org.hibernate.engine.TwoPhaseLoad:167) - done materializing entity [com.qas.newmedia.internet.core.page.model.Asset#1]
2005-05-24 11:35:37,033 - DEBUG (org.hibernate.engine.PersistenceContext:738) - initializing non-lazy collections
2005-05-24 11:35:37,033 - DEBUG (org.hibernate.event.def.DefaultInitializeCollectionEventListener:42) - initializing collection [com.qas.newmedia.internet.core.page.model.Asset.pages#1]
2005-05-24 11:35:37,033 - DEBUG (org.hibernate.event.def.DefaultInitializeCollectionEventListener:47) - checking second-level cache
2005-05-24 11:35:37,033 - DEBUG (org.hibernate.event.def.DefaultInitializeCollectionEventListener:59) - collection not cached
2005-05-24 11:35:37,033 - DEBUG (org.hibernate.loader.Loader:1336) - batch loading collection: [com.qas.newmedia.internet.core.page.model.Asset.pages#1]
2005-05-24 11:35:37,033 - DEBUG (org.hibernate.jdbc.AbstractBatcher:258) - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
2005-05-24 11:35:37,033 - DEBUG (org.hibernate.jdbc.AbstractBatcher:292) - select pages0_.asset_id as asset2___, pages0_.page_id as page1___, asset1_.asset_id as asset1_0_, asset1_.name_id as name2_2_0_, asset1_.status as status2_0_, asset1_.created as created2_0_, asset1_.released as released2_0_, asset1_.expiry as expiry2_0_, asset1_.version as version2_0_, asset1_.type as type2_0_, asset1_.filename as filename2_0_, asset1_.ext as ext2_0_, asset1_.ui_type as ui11_2_0_ from dbWeb.dbo.tblPageAssets pages0_ inner join dbWeb.dbo.tblAssets asset1_ on pages0_.page_id=asset1_.asset_id where pages0_.asset_id=?
2005-05-24 11:35:37,033 - DEBUG (org.hibernate.jdbc.AbstractBatcher:343) - preparing statement
2005-05-24 11:35:37,033 - DEBUG (org.hibernate.type.NullableType:59) - binding '1' to parameter: 1
2005-05-24 11:35:37,048 - DEBUG (org.hibernate.jdbc.AbstractBatcher:274) - about to open ResultSet (open ResultSets: 0, globally: 0)
2005-05-24 11:35:37,048 - DEBUG (org.hibernate.loader.Loader:610) - result set contains (possibly empty) collection: [com.qas.newmedia.internet.core.page.model.Asset.pages#1]
2005-05-24 11:35:37,048 - DEBUG (org.hibernate.engine.CollectionLoadContext:78) - uninitialized collection: initializing
2005-05-24 11:35:37,048 - DEBUG (org.hibernate.loader.Loader:377) - processing result set
2005-05-24 11:35:37,048 - DEBUG (org.hibernate.loader.Loader:399) - done processing result set (0 rows)
2005-05-24 11:35:37,048 - DEBUG (org.hibernate.jdbc.AbstractBatcher:281) - about to close ResultSet (open ResultSets: 1, globally: 1)
2005-05-24 11:35:37,048 - DEBUG (org.hibernate.jdbc.AbstractBatcher:266) - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
2005-05-24 11:35:37,048 - DEBUG (org.hibernate.jdbc.AbstractBatcher:363) - closing statement
2005-05-24 11:35:37,064 - DEBUG (org.hibernate.loader.Loader:450) - total objects hydrated: 0
2005-05-24 11:35:37,064 - DEBUG (org.hibernate.engine.CollectionLoadContext:239) - 1 collections were found in result set
2005-05-24 11:35:37,064 - DEBUG (org.hibernate.engine.CollectionLoadContext:193) - collection fully initialized: [com.qas.newmedia.internet.core.page.model.Asset.pages#1]
2005-05-24 11:35:37,064 - DEBUG (org.hibernate.engine.CollectionLoadContext:247) - 1 collections initialized
2005-05-24 11:35:37,064 - DEBUG (org.hibernate.loader.Loader:1360) - done loading collection
2005-05-24 11:35:37,064 - DEBUG (org.hibernate.event.def.DefaultInitializeCollectionEventListener:61) - collection initialized
2005-05-24 11:35:37,064 - DEBUG (org.hibernate.loader.Loader:1278) - done entity load
2005-05-24 11:35:37,064 - DEBUG (org.hibernate.event.def.AbstractSaveEventListener:392) - persistent instance of: com.qas.newmedia.internet.core.page.model.Asset
2005-05-24 11:35:37,064 - DEBUG (org.hibernate.event.def.DefaultSaveOrUpdateEventListener:103) - ignoring persistent instance
2005-05-24 11:35:37,095 - DEBUG (org.hibernate.event.def.DefaultSaveOrUpdateEventListener:140) - object already associated with session: [com.qas.newmedia.internet.core.page.model.Asset#1]
2005-05-24 11:35:37,111 - DEBUG (org.hibernate.transaction.JDBCTransaction:83) - commit
2005-05-24 11:35:37,111 - DEBUG (org.hibernate.impl.SessionImpl:292) - automatically flushing session
2005-05-24 11:35:37,111 - DEBUG (org.hibernate.event.def.AbstractFlushingEventListener:52) - flushing session
2005-05-24 11:35:37,111 - DEBUG (org.hibernate.event.def.AbstractFlushingEventListener:102) - processing flush-time cascades
2005-05-24 11:35:37,111 - DEBUG (org.hibernate.engine.Cascades:806) - processing cascade ACTION_SAVE_UPDATE for: com.qas.newmedia.internet.core.page.model.Page
2005-05-24 11:35:37,111 - DEBUG (org.hibernate.engine.Cascades:855) - cascade ACTION_SAVE_UPDATE for collection: com.qas.newmedia.internet.core.page.model.Page.childPages
2005-05-24 11:35:37,111 - DEBUG (org.hibernate.engine.Cascades:873) - done cascade ACTION_SAVE_UPDATE for collection: com.qas.newmedia.internet.core.page.model.Page.childPages
2005-05-24 11:35:37,111 - DEBUG (org.hibernate.engine.Cascades:855) - cascade ACTION_SAVE_UPDATE for collection: com.qas.newmedia.internet.core.page.model.Page.assets
2005-05-24 11:35:37,111 - DEBUG (org.hibernate.engine.Cascades$5:152) - cascading to saveOrUpdate: com.qas.newmedia.internet.core.page.model.Asset
2005-05-24 11:35:37,111 - DEBUG (org.hibernate.event.def.AbstractSaveEventListener:392) - persistent instance of: com.qas.newmedia.internet.core.page.model.Asset
2005-05-24 11:35:37,111 - DEBUG (org.hibernate.event.def.DefaultSaveOrUpdateEventListener:103) - ignoring persistent instance
2005-05-24 11:35:37,111 - DEBUG (org.hibernate.event.def.DefaultSaveOrUpdateEventListener:140) - object already associated with session: [com.qas.newmedia.internet.core.page.model.Asset#1]
2005-05-24 11:35:37,111 - DEBUG (org.hibernate.engine.Cascades:873) - done cascade ACTION_SAVE_UPDATE for collection: com.qas.newmedia.internet.core.page.model.Page.assets
2005-05-24 11:35:37,126 - DEBUG (org.hibernate.engine.Cascades:831) - done processing cascade ACTION_SAVE_UPDATE for: com.qas.newmedia.internet.core.page.model.Page
2005-05-24 11:35:37,126 - DEBUG (org.hibernate.engine.Cascades:806) - processing cascade ACTION_SAVE_UPDATE for: com.qas.newmedia.internet.core.page.model.Asset
2005-05-24 11:35:37,126 - DEBUG (org.hibernate.engine.Cascades:855) - cascade ACTION_SAVE_UPDATE for collection: com.qas.newmedia.internet.core.page.model.Asset.pages
2005-05-24 11:35:37,126 - DEBUG (org.hibernate.engine.Cascades$5:152) - cascading to saveOrUpdate: com.qas.newmedia.internet.core.page.model.Asset
2005-05-24 11:35:37,126 - DEBUG (org.hibernate.event.def.AbstractSaveEventListener:392) - persistent instance of: com.qas.newmedia.internet.core.page.model.Asset
2005-05-24 11:35:37,126 - DEBUG (org.hibernate.event.def.DefaultSaveOrUpdateEventListener:103) - ignoring persistent instance
2005-05-24 11:35:37,126 - DEBUG (org.hibernate.event.def.DefaultSaveOrUpdateEventListener:140) - object already associated with session: [com.qas.newmedia.internet.core.page.model.Page#1]
2005-05-24 11:35:37,126 - DEBUG (org.hibernate.engine.Cascades:873) - done cascade ACTION_SAVE_UPDATE for collection: com.qas.newmedia.internet.core.page.model.Asset.pages
2005-05-24 11:35:37,126 - DEBUG (org.hibernate.engine.Cascades:831) - done processing cascade ACTION_SAVE_UPDATE for: com.qas.newmedia.internet.core.page.model.Asset
2005-05-24 11:35:37,126 - DEBUG (org.hibernate.event.def.AbstractFlushingEventListener:150) - dirty checking collections
2005-05-24 11:35:37,126 - DEBUG (org.hibernate.engine.CollectionEntry:115) - Collection dirty: [com.qas.newmedia.internet.core.page.model.Page.assets#1]
2005-05-24 11:35:37,126 - DEBUG (org.hibernate.engine.CollectionEntry:115) - Collection dirty: [com.qas.newmedia.internet.core.page.model.Asset.pages#1]
2005-05-24 11:35:37,126 - DEBUG (org.hibernate.event.def.AbstractFlushingEventListener:167) - Flushing entities and processing referenced collections
2005-05-24 11:35:37,142 - DEBUG (org.hibernate.engine.Collections:108) - Collection found: [com.qas.newmedia.internet.core.page.model.Page.childPages#1], was: [com.qas.newmedia.internet.core.page.model.Page.childPages#1] (initialized)
2005-05-24 11:35:37,142 - DEBUG (org.hibernate.engine.Collections:108) - Collection found: [com.qas.newmedia.internet.core.page.model.Page.assets#1], was: [com.qas.newmedia.internet.core.page.model.Page.assets#1] (initialized)
2005-05-24 11:35:37,142 - DEBUG (org.hibernate.engine.Collections:108) - Collection found: [com.qas.newmedia.internet.core.page.model.Asset.pages#1], was: [com.qas.newmedia.internet.core.page.model.Asset.pages#1] (initialized)
2005-05-24 11:35:37,142 - DEBUG (org.hibernate.event.def.AbstractFlushingEventListener:203) - Processing unreferenced collections
2005-05-24 11:35:37,142 - DEBUG (org.hibernate.event.def.AbstractFlushingEventListener:217) - Scheduling collection removes/(re)creates/updates
2005-05-24 11:35:37,158 - DEBUG (org.hibernate.event.def.AbstractFlushingEventListener:79) - Flushed: 0 insertions, 0 updates, 0 deletions to 2 objects
2005-05-24 11:35:37,158 - DEBUG (org.hibernate.event.def.AbstractFlushingEventListener:85) - Flushed: 0 (re)creations, 2 updates, 0 removals to 3 collections
2005-05-24 11:35:37,158 - DEBUG (org.hibernate.pretty.Printer:83) - listing entities:
2005-05-24 11:35:37,173 - DEBUG (org.hibernate.transaction.JDBCTransaction:124) - rollback
2005-05-24 11:35:37,173 - DEBUG (org.hibernate.jdbc.JDBCContext:208) - before transaction completion
2005-05-24 11:35:37,173 - DEBUG (org.hibernate.impl.SessionImpl:337) - before transaction completion
2005-05-24 11:35:37,173 - DEBUG (org.hibernate.transaction.JDBCTransaction:135) - rolled back JDBC Connection
2005-05-24 11:35:37,173 - DEBUG (org.hibernate.jdbc.JDBCContext:213) - after transaction completion
2005-05-24 11:35:37,173 - DEBUG (org.hibernate.impl.SessionImpl:353) - after transaction completion
2005-05-24 11:35:37,173 - DEBUG (org.hibernate.transaction.JDBCTransaction:157) - re-enabling autocommit
2005-05-24 11:35:37,189 - DEBUG (org.hibernate.impl.SessionImpl:246) - closing session
2005-05-24 11:35:37,189 - DEBUG (org.hibernate.jdbc.AbstractBatcher:394) - closing JDBC connection (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)
2005-05-24 11:35:37,189 - DEBUG (org.hibernate.jdbc.JDBCContext:213) - after transaction completion
2005-05-24 11:35:37,189 - DEBUG (org.hibernate.impl.SessionImpl:353) - after transaction completion
005-05-24 11:37:27,002 - DEBUG (org.hibernate.jdbc.JDBCContext:247) - running Session.finalize()


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 24, 2005 6:54 am 
Senior
Senior

Joined: Fri Jun 18, 2004 10:17 am
Posts: 140
Dear me. I've just spotted it re-reading my post. I had Asset in the pages collection of Asset. I've modified this to the correct type Page and it's fine.

Thanks anyways!

Code:
      <set name="pages"
         table="tblPageAssets"
         lazy="false"
         inverse="true"
         cascade="save-update">
         
         <key column="asset_id" />
         
         <many-to-many
            class="Page"
            column="page_id"
         />
      </set>


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