Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version:
Mapping documents:
Code between sessionFactory.openSession() and session.close():
Full stack trace of any exception that occurs:
Name and version of the database you are using:
The generated SQL (show_sql=true):
Debug level Hibernate log excerpt:
I am having dificulty trying to enable an xml export from a basic model.
I have had to cut the xml part down to a simple listing of single elements in one class only in an attempy to isolate the issue but am a little stumped now and would appriciate some help.
version 3.0.5.
Stacktrace:
java.lang.ClassCastException at org.hibernate.type.CompositeCustomType.setToXMLNode(CompositeCustomType.java:246) 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:2919) 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.doList(Loader.java:1593) at org.hibernate.loader.Loader.list(Loader.java:1577) at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:395) at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:271) at org.hibernate.impl.SessionImpl.list(SessionImpl.java:844) at org.hibernate.impl.QueryImpl.list(QueryImpl.java:74) at com.sorted.property.test.ReadXMLTest.testCreateDocument(Unknown Source) at com.sorted.property.test.TestCase.runTest(Unknown Source)
code:
initData();
Session session = HibernateUtil.getSession();
Session dom4jSession = session.getSession(EntityMode.DOM4J);
Document doc = DocumentFactory.getInstance().createDocument();
Element root = doc.addElement("root");
Query q = dom4jSession.getNamedQuery("findPropertyInPriceRange");
q.setParameter("minAmount", new BigDecimal(0));
q.setParameter("maxAmount", new BigDecimal(10000000));
System.out.println("b4 problem");
List p = q.list();
// List results = dom4jSession.createQuery("from Property prop").list();
System.out.println("after");
addToNode(p, root);
XMLWriter writer = new XMLWriter(new FileWriter("C:\\test.xml"));
writer.write(doc);
writer.close();