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

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: any types cannot be stringified in DOM4J Entity Model
PostPosted: Thu Jan 12, 2006 7:56 am 
Beginner
Beginner

Joined: Thu Apr 07, 2005 5:12 pm
Posts: 27
Location: Hamburg
Hibernate version: 3.0.5

Mapping documents:
<any name="owner" id-type="long" meta-type="string" node="owner">
<meta-value value="person.Customer" class="person.Customer"/>
<meta-value value="person.Supplier" class="person.Supplier"/>
<meta-value value="person.Manufacturer" class="person.Manufacturer"/>

<column name="ref_owner_type" not-null="true" />
<column name="ref_owner_id" not-null="true" />
</any>

</joined-subclass>
Code between sessionFactory.openSession() and session.close():
Session dom4JSession = service.getDom4JSession();

service.getTransaction();

String outputpath=getOutputFolder();
for (String entity : entities){
Criteria criteria = dom4JSession.createCriteria(entity);
criteria.setLockMode(LockMode.READ);
List<AbstractElement> result = criteria.list();
.....
dom4JSession.commit();
dom4JSession.close();

Full stack trace of any exception that occurs:
java.lang.UnsupportedOperationException: any types cannot be stringified
at org.hibernate.type.AnyType.setToXMLNode(AnyType.java:151)
at org.hibernate.property.Dom4jAccessor$ElementSetter.set(Dom4jAccessor.java:307)
at org.hibernate.tuple.AbstractTuplizer.setPropertyValues(AbstractTuplizer.java:207)
at org.hibernate.persister.entity.BasicEntityPersister.setPropertyValues(BasicEntityPersister.java:2875)
at org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:113)
at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:530)
at org.hibernate.loader.Loader.doQuery(Loader.java:436)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:218)
at org.hibernate.loader.Loader.loadCollection(Loader.java:1434)
at org.hibernate.loader.collection.OneToManyLoader.initialize(OneToManyLoader.java:111)
at org.hibernate.persister.collection.AbstractCollectionPersister.initialize(AbstractCollectionPersister.java:488)
at org.hibernate.event.def.DefaultInitializeCollectionEventListener.onInitializeCollection(DefaultInitializeCollectionEventListener.java:60)
at org.hibernate.impl.SessionImpl.initializeCollection(SessionImpl.java:1431)
at org.hibernate.type.CollectionType.getCollection(CollectionType.java:484)
at org.hibernate.type.CollectionType.resolveKey(CollectionType.java:333)
at org.hibernate.type.CollectionType.resolve(CollectionType.java:326)
at org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:105)
at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:530)
at org.hibernate.loader.Loader.doQuery(Loader.java:436)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:218)
at org.hibernate.loader.Loader.doList(Loader.java:1593)
at org.hibernate.loader.Loader.list(Loader.java:1577)
at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:111)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1322)
at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:300)
at de.innuce.allinitializer.dataexport.Exporter.main(Exporter.java:46)
Name and version of the database you are using: Postgres 8

The generated SQL (show_sql=true):
Hibernate: select customer0_.pk_personrole as id0_, customer0_1_.version as version45_0_, customer0_1_.changePerson as changePe3_45_0_, customer0_1_.changeDate as changeDate45_0_, customer0_1_.email as email45_0_, customer0_1_.internetUrl as internet6_45_0_, customer0_1_.partner_id as partner7_45_0_, customer0_.contactstate as contacts2_47_0_, customer0_.ref_parent_type as ref3_47_0_, customer0_.ref_parent as ref4_47_0_ from Customer customer0_ inner join role customer0_1_ on customer0_.pk_personrole=customer0_1_.id where customer0_.pk_personrole=?
Hibernate: select addresses0_.role_id as role14_1_, addresses0_.id as id1_, addresses0_.id as id0_, addresses0_.version as version41_0_, addresses0_.changePerson as changePe4_41_0_, addresses0_.changeDate as changeDate41_0_, addresses0_.type as type41_0_, addresses0_.addressType as addressT7_41_0_, addresses0_.deviantName1 as deviantN8_41_0_, addresses0_.deviantName2 as deviantN9_41_0_, addresses0_.line1 as line10_41_0_, addresses0_.line2 as line11_41_0_, addresses0_.line3 as line12_41_0_, addresses0_.line4 as line13_41_0_, addresses0_.role_id as role14_41_0_, addresses0_.isoCountryCode as isoCoun15_41_0_, addresses0_.subclass as subclass0_ from address addresses0_ where addresses0_.role_id=? order by addresses0_.addressType
Hibernate: select phones0_.role_id as role5_1_, phones0_.id as id1_, phones0_.id as id0_, phones0_.version as version56_0_, phones0_.numba as numba56_0_, phones0_.type as type56_0_ from phone phones0_ where phones0_.role_id=?
Hibernate: select bankaccoun0_.role_id as role10_1_, bankaccoun0_.id as id1_, bankaccoun0_.id as id0_, bankaccoun0_.version as version57_0_, bankaccoun0_.changePerson as changePe4_57_0_, bankaccoun0_.changeDate as changeDate57_0_, bankaccoun0_.bankname as bankname57_0_, bankaccoun0_.bankIdentifier as bankIden7_57_0_, bankaccoun0_.accountIdentifier as accountI8_57_0_, bankaccoun0_.validTilDate as validTil9_57_0_, bankaccoun0_.subclass as subclass0_ from bankaccount bankaccoun0_ where bankaccoun0_.role_id=?
Debug level Hibernate log excerpt:

I use DOM4J Entity Model to export data. When I have some "any-mapped" classes, the error above occurs. Any ideas what I am doing wrong?


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

All times are UTC - 5 hours [ DST ]


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

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