From: Ignat Z. (JIRA) <no...@at...> - 2006-07-19 13:20:57
|
Incorrect documentation regarding XML manipulation in Hibernate reference manual (chapter 18.3). ------------------------------------------------------------------------------------------------ Key: HHH-1920 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1920 Project: Hibernate3 Type: Bug Versions: 3.1.3 Reporter: Ignat Zapolsky Priority: Trivial Manual has following sample (chapter 18.3): Session session = factory.openSession(); Session dom4jSession = session.getSession(EntityMode.DOM4J); Transaction tx = session.beginTransaction(); List results = dom4jSession .createQuery("from Customer c left join fetch c.accounts where c.lastName like :lastName") .list(); for ( int i=0; i<results.size(); i++ ) { //add the customer data to the XML document Element customer = (Element) results.get(i); doc.add(customer); } Mentioned code simply changes root node of doc, but supposed to add child elements. Correct code shall look like: Session session = factory.openSession(); Session dom4jSession = session.getSession(EntityMode.DOM4J); Transaction tx = session.beginTransaction(); List results = dom4jSession .createQuery("from Customer c left join fetch c.accounts where c.lastName like :lastName") .list(); for ( int i=0; i<results.size(); i++ ) { //add the customer data to the XML document Element customer = (Element) results.get(i); doc.getRootEelemnt().add(customer); } -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |