-->
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.  [ 5 posts ] 
Author Message
 Post subject: @Loader on @OneTOMany doesn't work
PostPosted: Wed May 19, 2010 4:01 am 
Newbie

Joined: Tue May 18, 2010 10:17 am
Posts: 4
Hi,

I have the following problem. I use hibernate (3.5.1) mostly as a JPA implementation, but because I also use Derby with XML fields I need to also override the SQL's that hibernate is executing when working with Derby XML fields (basically to read / write from Derby XML fields I need to use XMLSERIALIZE and XMLPARSE).

The override of the SQL's that hibernate is using for CRUD operation on the Entity level worked just fine, The problem that I'm heaving is when I try to use a @Loader for a @OneToMany relation.

I have 2 entities:

@Entity
@NamedNativeQuery(name = "findDocumentVersionsByDocumentId", query = "....")
public class Document {
....
@OneToMany(mappedBy = "document", fetch = FetchType.LAZY, cascade = {
CascadeType.PERSIST, CascadeType.MERGE })
@Loader(namedQuery = "findDocumentVersionsByDocumentId")
public Set<DocumentVersion> getDocumentVersions() {
return documentVersions;
}
....
}

and DocumentVersion entity which contain an XML field mapped as @Lob String.

The problem is that when I try to access the documentVersions the result of the executed NamedNativeQuery is not loaded into the documentVersions PersistentSet, even though the query has executed correctly and the results were added to the DocumentVersion entity (I saw this from the hibernate traces).
So, after trying to load this set if I try to access the set size I get a NullPointerException basically because the set from PersistentSet is null.

I did some research and saw that using hibernate mapping xml files this problem could be solved by specifying to the named native query a <load-collection.. instead of a result class so my questions are:

1. How could I specify a load-collection for a named native query using hibernate annotation, not xml mapping files?
2. Is there another way to specify a custom loader for a @OneToMany collection?

Thanks,
Dan


Top
 Profile  
 
 Post subject: Re: @Loader on @OneTOMany doesn't work
PostPosted: Wed May 19, 2010 4:45 am 
Newbie

Joined: Tue May 18, 2010 10:17 am
Posts: 4
I forgot to attach the hibernate traces, here they are:

TRACE: org.hibernate.event.def.DefaultInitializeCollectionEventListener - initializing collection [com.siemens.scr.sciport.persistence.model.Document.documentVersions#c8cbcd73-43e3-41cd-9a00-c633011e08c4]
TRACE: org.hibernate.event.def.DefaultInitializeCollectionEventListener - checking second-level cache
TRACE: org.hibernate.event.def.DefaultInitializeCollectionEventListener - collection not cached
DEBUG: org.hibernate.persister.collection.NamedQueryCollectionInitializer - initializing collection: com.siemens.scr.sciport.persistence.model.Document.documentVersions using named query: findDocumentVersionsByDocumentId
TRACE: org.hibernate.impl.SessionImpl - setting flush mode to: MANUAL
TRACE: org.hibernate.impl.SessionImpl - setting cache mode to: NORMAL
TRACE: org.hibernate.engine.query.QueryPlanCache - located native-sql query plan in cache (SELECT XMLSERIALIZE (content as CLOB) AS content, description, template_id, templateVersion, title, document_id, version FROM sciport.document_versions WHERE document_id = :id)
TRACE: org.hibernate.impl.SessionImpl - SQL query: SELECT XMLSERIALIZE (content as CLOB) AS content, description, template_id, templateVersion, title, document_id, version FROM sciport.document_versions WHERE document_id = ?
DEBUG: org.hibernate.jdbc.AbstractBatcher - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
DEBUG: org.hibernate.SQL - SELECT XMLSERIALIZE (content as CLOB) AS content, description, template_id, templateVersion, title, document_id, version FROM sciport.document_versions WHERE document_id = ?
Hibernate: SELECT XMLSERIALIZE (content as CLOB) AS content, description, template_id, templateVersion, title, document_id, version FROM sciport.document_versions WHERE document_id = ?
TRACE: org.hibernate.jdbc.AbstractBatcher - preparing statement
DEBUG: org.hibernate.loader.Loader - bindNamedParameters() c8cbcd73-43e3-41cd-9a00-c633011e08c4 -> id [1]
TRACE: org.hibernate.type.StringType - binding 'c8cbcd73-43e3-41cd-9a00-c633011e08c4' to parameter: 1
TRACE: org.hibernate.loader.Loader - Bound [2] parameters total
DEBUG: org.hibernate.jdbc.AbstractBatcher - about to open ResultSet (open ResultSets: 0, globally: 0)
TRACE: org.hibernate.loader.Loader - processing result set
DEBUG: org.hibernate.loader.Loader - result set row: 0
TRACE: org.hibernate.type.StringType - returning 'c8cbcd73-43e3-41cd-9a00-c633011e08c4' as column: document_id
TRACE: org.hibernate.type.IntegerType - returning '0' as column: version
DEBUG: org.hibernate.loader.Loader - result row: EntityKey[com.siemens.scr.sciport.persistence.model.DocumentVersion#component[documentId,version]{documentId=c8cbcd73-43e3-41cd-9a00-c633011e08c4, version=0}]
TRACE: org.hibernate.loader.Loader - done processing result set (1 rows)
DEBUG: org.hibernate.jdbc.AbstractBatcher - about to close ResultSet (open ResultSets: 1, globally: 1)
DEBUG: org.hibernate.jdbc.AbstractBatcher - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
TRACE: org.hibernate.jdbc.AbstractBatcher - closing statement
TRACE: org.hibernate.loader.Loader - total objects hydrated: 0
DEBUG: org.hibernate.engine.StatefulPersistenceContext - initializing non-lazy collections
TRACE: org.hibernate.impl.SessionImpl - setting flush mode to: AUTO
TRACE: org.hibernate.impl.SessionImpl - setting cache mode to: NORMAL
TRACE: org.hibernate.event.def.DefaultInitializeCollectionEventListener - collection initialized


Top
 Profile  
 
 Post subject: Re: @Loader on @OneTOMany doesn't work
PostPosted: Wed May 19, 2010 7:21 am 
Newbie

Joined: Tue May 18, 2010 10:17 am
Posts: 4
I've solved the problem like this:

I've moved the native sql query (an only it) into an hbm.xml file - using the <load-collection..., and referenced it from the Document @Loader annotation, and the collection was initialized.

So, as a conclusion:
I think there's a problem when executing a native sql query as loader for a OneToMany relation, related with the fact that the <load-colleaction cannot be specified by annotation. The problem might be in the fact that the result entity is not hydrated even though we get a result from the sql execution.

Here's the new trace for executing the hbm.xml native sql query:

Code:
TRACE: org.hibernate.event.def.DefaultInitializeCollectionEventListener - initializing collection [com.siemens.scr.sciport.persistence.model.Document.documentVersions#e49e39c9-4490-4ef8-864d-926769cd7d28]
TRACE: org.hibernate.event.def.DefaultInitializeCollectionEventListener - checking second-level cache
TRACE: org.hibernate.event.def.DefaultInitializeCollectionEventListener - collection not cached
DEBUG: org.hibernate.persister.collection.NamedQueryCollectionInitializer - initializing collection: com.siemens.scr.sciport.persistence.model.Document.documentVersions using named query: loadDocumentVersionsByDocumentId
TRACE: org.hibernate.impl.SessionImpl - setting flush mode to: MANUAL
TRACE: org.hibernate.engine.query.QueryPlanCache - located native-sql query plan in cache (SELECT XMLSERIALIZE (content as CLOB) AS content, description,
      template_id, templateVersion, title, document_id, version FROM
      sciport.document_versions WHERE document_id = :id)
TRACE: org.hibernate.impl.SessionImpl - SQL query: SELECT XMLSERIALIZE (content as CLOB) AS content, description,
      template_id, templateVersion, title, document_id, version FROM
      sciport.document_versions WHERE document_id = ?
DEBUG: org.hibernate.jdbc.AbstractBatcher - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
DEBUG: org.hibernate.SQL - SELECT XMLSERIALIZE (content as CLOB) AS content, description,
      template_id, templateVersion, title, document_id, version FROM
      sciport.document_versions WHERE document_id = ?
Hibernate: SELECT XMLSERIALIZE (content as CLOB) AS content, description,
      template_id, templateVersion, title, document_id, version FROM
      sciport.document_versions WHERE document_id = ?
TRACE: org.hibernate.jdbc.AbstractBatcher - preparing statement
DEBUG: org.hibernate.loader.Loader - bindNamedParameters() e49e39c9-4490-4ef8-864d-926769cd7d28 -> id [1]
TRACE: org.hibernate.type.StringType - binding 'e49e39c9-4490-4ef8-864d-926769cd7d28' to parameter: 1
TRACE: org.hibernate.loader.Loader - Bound [2] parameters total
DEBUG: org.hibernate.jdbc.AbstractBatcher - about to open ResultSet (open ResultSets: 0, globally: 0)
DEBUG: org.hibernate.loader.Loader - result set contains (possibly empty) collection: [com.siemens.scr.sciport.persistence.model.Document.documentVersions#e49e39c9-4490-4ef8-864d-926769cd7d28]
TRACE: org.hibernate.engine.loading.LoadContexts - constructing collection load context for result set [org.apache.derby.impl.jdbc.EmbedResultSet40@1e581f9]
TRACE: org.hibernate.engine.loading.CollectionLoadContext - starting attempt to find loading collection [[com.siemens.scr.sciport.persistence.model.Document.documentVersions#e49e39c9-4490-4ef8-864d-926769cd7d28]]
TRACE: org.hibernate.engine.loading.CollectionLoadContext - collection not yet initialized; initializing
TRACE: org.hibernate.loader.Loader - processing result set
DEBUG: org.hibernate.loader.Loader - result set row: 0
TRACE: org.hibernate.type.StringType - returning 'e49e39c9-4490-4ef8-864d-926769cd7d28' as column: document_id
TRACE: org.hibernate.type.IntegerType - returning '0' as column: version
DEBUG: org.hibernate.loader.Loader - result row: EntityKey[com.siemens.scr.sciport.persistence.model.DocumentVersion#component[documentId,version]{documentId=e49e39c9-4490-4ef8-864d-926769cd7d28, version=0}]
TRACE: org.hibernate.loader.Loader - Initializing object from ResultSet: [com.siemens.scr.sciport.persistence.model.DocumentVersion#component[documentId,version]{documentId=e49e39c9-4490-4ef8-864d-926769cd7d28, version=0}]
TRACE: org.hibernate.persister.entity.AbstractEntityPersister - Hydrating entity: [com.siemens.scr.sciport.persistence.model.DocumentVersion#component[documentId,version]{documentId=e49e39c9-4490-4ef8-864d-926769cd7d28, version=0}]
TRACE: org.hibernate.type.MaterializedClobType - returning '<document id="541a7590-32da-48cf-93f0-51afea4f2d36" modelId="a2e59b0f-3a12-4315-967a-6c304d960666"><group id="929614e7-94d3-4772-b4b3-e38d90f912c6"><record><field id="d7b53351-c29c-49a5-b152-e7fb3d9866ed"><value><text>Document Value For Text Element Field With Default Value</text></value></field><field id="c09ffe63-85f2-418e-8953-cc2986ef9dbb"><value><text>Document Value For Text Element Field Without Default Value</text></value></field><field id="3fd5a480-6207-4a89-b874-9747cb7aa773"><value><datetime>2010-01-01T00:00:00.000+02:00</datetime></value></field><field id="e9829b2d-5d4f-40df-8078-78e22774cf59"><value><datetime>2010-02-01T00:00:00.000+02:00</datetime></value></field><field id="c8faa680-1b70-430d-8867-764bb1450ea8"><value><boolean>true</boolean></value></field><field id="305a08af-12d3-4a73-bcb9-4480638749bc"><value><boolean>false</boolean></value></field><field id="56211b9c-0038-4454-8c94-46a19eed69cf"><value><uri>http://www.test.with.default.com</uri></value></field><field id="ad54a0be-e3b8-46c1-b20e-0f898eca0c5d"><value><uri>http://www.test.without.default.com</uri></value></field><field id="a19d0af2-b6e9-4a55-bd4e-a055961d2922"><value><number type="double">1.2345678999999E7</number></value></field><field id="95ee7585-74aa-4781-bc8f-14837e96ead9"><value><number type="integer">789</number></value></field><field id="960e9ab7-b702-4744-9ddd-74724c7767e8"><value><text>f6336ff1-7cc7-4757-872c-29de24ab4b42</text></value></field><field id="9aaeb481-7bc3-4753-8263-7ecde063a57d"><value><list><text id="a3a95f00-9f08-4727-b6b0-9c50a030afe4"/><text id="245254d8-7b4a-4ddb-96d8-959f12e34f6a"/></list></value></field><field id="adf34a3a-af35-430d-958a-6d39cf6d8c7d"><value><list><boolean id="76748c05-4ef7-4276-9d61-a0b6fcd2244b"/></list></value></field><field id="91b598e6-174b-4d56-b5ba-bcf49a158ab2"><value><list><datetime id="f94c7259-83dd-4fdd-b8c2-b792a6779238"/><datetime id="9fbf3e2d-c095-4db6-b9f0-ac8af4745e79"/></list></value></field><field id="0deede3d-0602-4d42-ac41-88d5057ca0d7"><value><list><uri id="84164eae-6b61-407c-b245-761a9b407839"/><uri id="7b0cd6da-049e-4769-88e6-da8caa7cf7be"/></list></value></field><field id="379cedc6-02c4-476c-aaae-dfa620749e36"><value><list><number id="2e43e729-a671-4b02-bff1-686ac16ac877"/><number id="11a6eaaa-1b68-401c-936c-f6cf58bd1c1c"/></list></value></field><field id="39e004b7-53f9-43e9-9b2a-4bb01b8b3f96"><value><array type="double"><dimension index="0" size="3"/><dimension index="1" size="4"/><dimension index="2" size="5"/><data index="0">0.0</data><data index="1">1.0</data><data index="2">2.0</data><data index="3">3.0</data><data index="4">4.0</data><data index="5">10.0</data><data index="6">11.0</data><data index="7">12.0</data><data index="8">13.0</data><data index="9">14.0</data><data index="10">20.0</data><data index="11">21.0</data><data index="12">22.0</data><data index="13">23.0</data><data index="14">24.0</data><data index="15">30.0</data><data index="16">31.0</data><data index="17">32.0</data><data index="18">33.0</data><data index="19">34.0</data><data index="20">100.0</data><data index="21">101.0</data><data index="22">102.0</data><data index="23">103.0</data><data index="24">104.0</data><data index="25">110.0</data><data index="26">111.0</data><data index="27">112.0</data><data index="28">113.0</data><data index="29">114.0</data><data index="30">120.0</data><data index="31">121.0</data><data index="32">122.0</data><data index="33">123.0</data><data index="34">124.0</data><data index="35">130.0</data><data index="36">131.0</data><data index="37">132.0</data><data index="38">133.0</data><data index="39">134.0</data><data index="40">200.0</data><data index="41">201.0</data><data index="42">202.0</data><data index="43">203.0</data><data index="44">204.0</data><data index="45">210.0</data><data index="46">211.0</data><data index="47">212.0</data><data index="48">213.0</data><data index="49">214.0</data><data index="50">220.0</data><data index="51">221.0</data><data index="52">222.0</data><data index="53">223.0</data><data index="54">224.0</data><data index="55">230.0</data><data index="56">231.0</data><data index="57">232.0</data><data index="58">233.0</data><data index="59">234.0</data></array></value></field><field id="00929ca7-d025-4586-9c3e-8b52dc6e5f2a"><value><list><uri>file:/D:/Java/Spring/Projects/sciport-model/target/test-classes/attachment/1.3.6.1.4.1.9328.50.46.110457431523378476826479982028289487890.dcm</uri><uri>file:/D:/Java/Spring/Projects/sciport-model/target/test-classes/attachment/1.3.6.1.4.1.9328.50.46.111743060478791400042685014793271166110.dcm</uri></list></value></field><group id="77518e81-758b-48ec-b1d0-0a2cecf83b97"><record><field id="66722d2e-0dbf-4d37-8670-a3fc40e59b67"><value><text>Document Value For Text Element Field With Default Value</text></value></field><field id="9a7938d2-fd05-4250-868f-cb01c67bb032"><value><text>Document Value For Text Element Field Without Default Value</text></value></field></record></group><group id="af855396-f18a-4ae7-bf7f-1841594f4113"><record><field id="0c56cf14-89da-4ddc-953f-633407c60aff"><value><text>Document Value For Text Element Field With Default Value</text></value></field><field id="9c21b647-5ab0-4720-90f1-f4195dde8d7c"><value><text>Document Value For Text Element Field Without Default Value</text></value></field><field id="b792e44f-e2fb-4b26-bb24-06ee72aa9e8d"><value><datetime>2010-01-01T00:00:00.000+02:00</datetime></value></field><field id="f98b107f-3da5-4eb2-a1d0-828615a0a709"><value><datetime>2010-02-01T00:00:00.000+02:00</datetime></value></field><field id="62076406-2714-441c-b685-011e1047492b"><value><boolean>true</boolean></value></field><field id="e8d03e72-01ea-4e22-938a-53b2936ec55f"><value><boolean>false</boolean></value></field><field id="528191d8-d620-4758-8f60-4236ca2a0b37"><value><uri>http://www.test.with.default.com</uri></value></field><field id="ae485e0f-aeed-4d0e-bc41-98fefdfc49bd"><value><uri>http://www.test.without.default.com</uri></value></field><field id="b6732590-bfd6-4ffa-8837-5e4923d19358"><value><number type="double">1.2345678999999E7</number></value></field><field id="3574104a-f107-4851-9da2-83a09e9d624c"><value><number type="integer">789</number></value></field><field id="d6165323-7017-4ff1-8aab-ff240613db87"><value><text>f6336ff1-7cc7-4757-872c-29de24ab4b42</text></value></field><field id="a6c07c99-a50b-4a61-83aa-29e105982c9e"><value><list><text id="a3a95f00-9f08-4727-b6b0-9c50a030afe4"/><text id="245254d8-7b4a-4ddb-96d8-959f12e34f6a"/></list></value></field><field id="dd8a60ae-43b2-46d8-8492-b670edd815a5"><value><list><boolean id="76748c05-4ef7-4276-9d61-a0b6fcd2244b"/></list></value></field><field id="0e98c59e-63ca-43db-b9b2-eae53ed92025"><value><list><datetime id="f94c7259-83dd-4fdd-b8c2-b792a6779238"/><datetime id="9fbf3e2d-c095-4db6-b9f0-ac8af4745e79"/></list></value></field><field id="b0d6ff46-13d0-4b04-a730-7dfa63906344"><value><list><uri id="84164eae-6b61-407c-b245-761a9b407839"/><uri id="7b0cd6da-049e-4769-88e6-da8caa7cf7be"/></list></value></field><field id="2259954d-5f60-4dfb-88e1-ea63204c5040"><value><list><number id="2e43e729-a671-4b02-bff1-686ac16ac877"/><number id="11a6eaaa-1b68-401c-936c-f6cf58bd1c1c"/></list></value></field><field id="f7fae33b-8d49-4a75-a033-10b8b7d28b79"><value><array type="double"><dimension index="0" size="3"/><dimension index="1" size="4"/><dimension index="2" size="5"/><data index="0">0.0</data><data index="1">1.0</data><data index="2">2.0</data><data index="3">3.0</data><data index="4">4.0</data><data index="5">10.0</data><data index="6">11.0</data><data index="7">12.0</data><data index="8">13.0</data><data index="9">14.0</data><data index="10">20.0</data><data index="11">21.0</data><data index="12">22.0</data><data index="13">23.0</data><data index="14">24.0</data><data index="15">30.0</data><data index="16">31.0</data><data index="17">32.0</data><data index="18">33.0</data><data index="19">34.0</data><data index="20">100.0</data><data index="21">101.0</data><data index="22">102.0</data><data index="23">103.0</data><data index="24">104.0</data><data index="25">110.0</data><data index="26">111.0</data><data index="27">112.0</data><data index="28">113.0</data><data index="29">114.0</data><data index="30">120.0</data><data index="31">121.0</data><data index="32">122.0</data><data index="33">123.0</data><data index="34">124.0</data><data index="35">130.0</data><data index="36">131.0</data><data index="37">132.0</data><data index="38">133.0</data><data index="39">134.0</data><data index="40">200.0</data><data index="41">201.0</data><data index="42">202.0</data><data index="43">203.0</data><data index="44">204.0</data><data index="45">210.0</data><data index="46">211.0</data><data index="47">212.0</data><data index="48">213.0</data><data index="49">214.0</data><data index="50">220.0</data><data index="51">221.0</data><data index="52">222.0</data><data index="53">223.0</data><data index="54">224.0</data><data index="55">230.0</data><data index="56">231.0</data><data index="57">232.0</data><data index="58">233.0</data><data index="59">234.0</data></array></value></field><field id="7197fd35-b49c-4507-8b08-4ba0fe93b1cb"><value><list><uri>file:/D:/Java/Spring/Projects/sciport-model/target/test-classes/attachment/1.3.6.1.4.1.9328.50.46.110457431523378476826479982028289487890.dcm</uri><uri>file:/D:/Java/Spring/Projects/sciport-model/target/test-classes/attachment/1.3.6.1.4.1.9328.50.46.111743060478791400042685014793271166110.dcm</uri></list></value></field></record><record><field id="0c56cf14-89da-4ddc-953f-633407c60aff"><value><text>Document Value For Text Element Field With Default Value</text></value></field><field id="9c21b647-5ab0-4720-90f1-f4195dde8d7c"><value><text>Document Value For Text Element Field Without Default Value</text></value></field><field id="b792e44f-e2fb-4b26-bb24-06ee72aa9e8d"><value><datetime>2010-01-01T00:00:00.000+02:00</datetime></value></field><field id="f98b107f-3da5-4eb2-a1d0-828615a0a709"><value><datetime>2010-02-01T00:00:00.000+02:00</datetime></value></field><field id="62076406-2714-441c-b685-011e1047492b"><value><boolean>true</boolean></value></field><field id="e8d03e72-01ea-4e22-938a-53b2936ec55f"><value><boolean>false</boolean></value></field><field id="528191d8-d620-4758-8f60-4236ca2a0b37"><value><uri>http://www.test.with.default.com</uri></value></field><field id="ae485e0f-aeed-4d0e-bc41-98fefdfc49bd"><value><uri>http://www.test.without.default.com</uri></value></field><field id="b6732590-bfd6-4ffa-8837-5e4923d19358"><value><number type="double">1.2345678999999E7</number></value></field><field id="3574104a-f107-4851-9da2-83a09e9d624c"><value><number type="integer">789</number></value></field><field id="d6165323-7017-4ff1-8aab-ff240613db87"><value><text>f6336ff1-7cc7-4757-872c-29de24ab4b42</text></value></field><field id="a6c07c99-a50b-4a61-83aa-29e105982c9e"><value><list><text id="a3a95f00-9f08-4727-b6b0-9c50a030afe4"/><text id="245254d8-7b4a-4ddb-96d8-959f12e34f6a"/></list></value></field><field id="dd8a60ae-43b2-46d8-8492-b670edd815a5"><value><list><boolean id="76748c05-4ef7-4276-9d61-a0b6fcd2244b"/></list></value></field><field id="0e98c59e-63ca-43db-b9b2-eae53ed92025"><value><list><datetime id="f94c7259-83dd-4fdd-b8c2-b792a6779238"/><datetime id="9fbf3e2d-c095-4db6-b9f0-ac8af4745e79"/></list></value></field><field id="b0d6ff46-13d0-4b04-a730-7dfa63906344"><value><list><uri id="84164eae-6b61-407c-b245-761a9b407839"/><uri id="7b0cd6da-049e-4769-88e6-da8caa7cf7be"/></list></value></field><field id="2259954d-5f60-4dfb-88e1-ea63204c5040"><value><list><number id="2e43e729-a671-4b02-bff1-686ac16ac877"/><number id="11a6eaaa-1b68-401c-936c-f6cf58bd1c1c"/></list></value></field><field id="f7fae33b-8d49-4a75-a033-10b8b7d28b79"><value><array type="double"><dimension index="0" size="3"/><dimension index="1" size="4"/><dimension index="2" size="5"/><data index="0">0.0</data><data index="1">1.0</data><data index="2">2.0</data><data index="3">3.0</data><data index="4">4.0</data><data index="5">10.0</data><data index="6">11.0</data><data index="7">12.0</data><data index="8">13.0</data><data index="9">14.0</data><data index="10">20.0</data><data index="11">21.0</data><data index="12">22.0</data><data index="13">23.0</data><data index="14">24.0</data><data index="15">30.0</data><data index="16">31.0</data><data index="17">32.0</data><data index="18">33.0</data><data index="19">34.0</data><data index="20">100.0</data><data index="21">101.0</data><data index="22">102.0</data><data index="23">103.0</data><data index="24">104.0</data><data index="25">110.0</data><data index="26">111.0</data><data index="27">112.0</data><data index="28">113.0</data><data index="29">114.0</data><data index="30">120.0</data><data index="31">121.0</data><data index="32">122.0</data><data index="33">123.0</data><data index="34">124.0</data><data index="35">130.0</data><data index="36">131.0</data><data index="37">132.0</data><data index="38">133.0</data><data index="39">134.0</data><data index="40">200.0</data><data index="41">201.0</data><data index="42">202.0</data><data index="43">203.0</data><data index="44">204.0</data><data index="45">210.0</data><data index="46">211.0</data><data index="47">212.0</data><data index="48">213.0</data><data index="49">214.0</data><data index="50">220.0</data><data index="51">221.0</data><data index="52">222.0</data><data index="53">223.0</data><data index="54">224.0</data><data index="55">230.0</data><data index="56">231.0</data><data index="57">232.0</data><data index="58">233.0</data><data index="59">234.0</data></array></value></field><field id="7197fd35-b49c-4507-8b08-4ba0fe93b1cb"><value><list><uri>file:/D:/Java/Spring/Projects/sciport-model/target/test-classes/attachment/1.3.6.1.4.1.9328.50.46.110457431523378476826479982028289487890.dcm</uri><uri>file:/D:/Java/Spring/Projects/sciport-model/target/test-classes/attachment/1.3.6.1.4.1.9328.50.46.111743060478791400042685014793271166110.dcm</uri></list></value></field></record></group></record></group></document>' as column: content
TRACE: org.hibernate.type.StringType - returning 'Bla Bla BLa......Description' as column: description
TRACE: org.hibernate.type.StringType - returning 'e49e39c9-4490-4ef8-864d-926769cd7d28' as column: document_id
TRACE: org.hibernate.type.IntegerType - returning null as column: template_id
TRACE: org.hibernate.type.StringType - returning null as column: templateVersion
TRACE: org.hibernate.type.StringType - returning null as column: title
TRACE: org.hibernate.type.StringType - returning 'e49e39c9-4490-4ef8-864d-926769cd7d28' as column: document_id
DEBUG: org.hibernate.loader.Loader - found row of collection: [com.siemens.scr.sciport.persistence.model.Document.documentVersions#e49e39c9-4490-4ef8-864d-926769cd7d28]
TRACE: org.hibernate.engine.loading.CollectionLoadContext - starting attempt to find loading collection [[com.siemens.scr.sciport.persistence.model.Document.documentVersions#e49e39c9-4490-4ef8-864d-926769cd7d28]]
TRACE: org.hibernate.engine.loading.LoadContexts - attempting to locate loading collection entry [CollectionKey[com.siemens.scr.sciport.persistence.model.Document.documentVersions#e49e39c9-4490-4ef8-864d-926769cd7d28]] in any result-set context
TRACE: org.hibernate.engine.loading.LoadContexts - collection [CollectionKey[com.siemens.scr.sciport.persistence.model.Document.documentVersions#e49e39c9-4490-4ef8-864d-926769cd7d28]] located in load context
TRACE: org.hibernate.engine.loading.CollectionLoadContext - found loading collection bound to current result set processing; reading row
TRACE: org.hibernate.type.StringType - returning 'e49e39c9-4490-4ef8-864d-926769cd7d28' as column: document_id
TRACE: org.hibernate.type.IntegerType - returning '0' as column: version
TRACE: org.hibernate.event.def.DefaultLoadEventListener - loading entity: [com.siemens.scr.sciport.persistence.model.DocumentVersion#component[documentId,version]{documentId=e49e39c9-4490-4ef8-864d-926769cd7d28, version=0}]
TRACE: org.hibernate.event.def.DefaultLoadEventListener - attempting to resolve: [com.siemens.scr.sciport.persistence.model.DocumentVersion#component[documentId,version]{documentId=e49e39c9-4490-4ef8-864d-926769cd7d28, version=0}]
TRACE: org.hibernate.event.def.DefaultLoadEventListener - resolved object in session cache: [com.siemens.scr.sciport.persistence.model.DocumentVersion#component[documentId,version]{documentId=e49e39c9-4490-4ef8-864d-926769cd7d28, version=0}]
TRACE: org.hibernate.loader.Loader - done processing result set (1 rows)
DEBUG: org.hibernate.jdbc.AbstractBatcher - about to close ResultSet (open ResultSets: 1, globally: 1)
DEBUG: org.hibernate.jdbc.AbstractBatcher - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
TRACE: org.hibernate.jdbc.AbstractBatcher - closing statement
TRACE: org.hibernate.loader.Loader - total objects hydrated: 1
DEBUG: org.hibernate.engine.TwoPhaseLoad - resolving associations for [com.siemens.scr.sciport.persistence.model.DocumentVersion#component[documentId,version]{documentId=e49e39c9-4490-4ef8-864d-926769cd7d28, version=0}]
TRACE: org.hibernate.event.def.DefaultLoadEventListener - loading entity: [com.siemens.scr.sciport.persistence.model.Document#e49e39c9-4490-4ef8-864d-926769cd7d28]
TRACE: org.hibernate.event.def.DefaultLoadEventListener - attempting to resolve: [com.siemens.scr.sciport.persistence.model.Document#e49e39c9-4490-4ef8-864d-926769cd7d28]
TRACE: org.hibernate.event.def.DefaultLoadEventListener - resolved object in session cache: [com.siemens.scr.sciport.persistence.model.Document#e49e39c9-4490-4ef8-864d-926769cd7d28]
DEBUG: org.hibernate.engine.TwoPhaseLoad - done materializing entity [com.siemens.scr.sciport.persistence.model.DocumentVersion#component[documentId,version]{documentId=e49e39c9-4490-4ef8-864d-926769cd7d28, version=0}]
TRACE: org.hibernate.engine.loading.LoadContexts - attempting to locate loading collection entry [CollectionKey[com.siemens.scr.sciport.persistence.model.Document.documentVersions#e49e39c9-4490-4ef8-864d-926769cd7d28]] in any result-set context
TRACE: org.hibernate.engine.loading.LoadContexts - collection [CollectionKey[com.siemens.scr.sciport.persistence.model.Document.documentVersions#e49e39c9-4490-4ef8-864d-926769cd7d28]] located in load context
TRACE: org.hibernate.engine.loading.CollectionLoadContext - removing collection load entry [org.hibernate.engine.loading.LoadingCollectionEntry<rs=org.apache.derby.impl.jdbc.EmbedResultSet40@1e581f9, coll=[com.siemens.scr.sciport.persistence.model.Document.documentVersions#e49e39c9-4490-4ef8-864d-926769cd7d28]>@13eabd9]
DEBUG: org.hibernate.engine.loading.CollectionLoadContext - 1 collections were found in result set for role: com.siemens.scr.sciport.persistence.model.Document.documentVersions
DEBUG: org.hibernate.engine.loading.CollectionLoadContext - ending loading collection [org.hibernate.engine.loading.LoadingCollectionEntry<rs=org.apache.derby.impl.jdbc.EmbedResultSet40@1e581f9, coll=[com.siemens.scr.sciport.persistence.model.Document.documentVersions#e49e39c9-4490-4ef8-864d-926769cd7d28]>@13eabd9]
DEBUG: org.hibernate.engine.loading.CollectionLoadContext - collection fully initialized: [com.siemens.scr.sciport.persistence.model.Document.documentVersions#e49e39c9-4490-4ef8-864d-926769cd7d28]
DEBUG: org.hibernate.engine.loading.CollectionLoadContext - 1 collections initialized for role: com.siemens.scr.sciport.persistence.model.Document.documentVersions
DEBUG: org.hibernate.engine.StatefulPersistenceContext - initializing non-lazy collections
TRACE: org.hibernate.impl.SessionImpl - setting flush mode to: AUTO
TRACE: org.hibernate.event.def.DefaultInitializeCollectionEventListener - collection initialized


Hope this helps,
Dan


Top
 Profile  
 
 Post subject: Re: @Loader on @OneTOMany doesn't work
PostPosted: Wed Aug 25, 2010 11:54 pm 
Newbie

Joined: Wed Aug 25, 2010 11:45 pm
Posts: 1
Hi Dan,

I am facing the same issue as you have described in your post. I have my native query executed successfully, but my PersistentSet is null.
Is there any other solution other than moving the query into a new hbm.xml file?

Thanks and regards,
Sathyam.


Top
 Profile  
 
 Post subject: Re: @Loader on @OneTOMany doesn't work
PostPosted: Thu Aug 26, 2010 2:38 am 
Newbie

Joined: Tue May 18, 2010 10:17 am
Posts: 4
Hi,

no, there isn't any other solution, at least none that I could find. The problem is that the annotation are not aligned with hbm.xml. So for the @Loader annotation on the @OneToMany you do not have the possibility to specify load-collection. Maybe a JIRA should be created in this case for improvement of the @Loader annotation.

Regards,
Dan


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