[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-1920?page=c...
]
Diego Pires Plentz resolved HHH-1920.
-------------------------------------
Resolution: Fixed
Fix Version/s: 3.3
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
Issue Type: Bug
Components: documentation
Affects Versions: 3.1.3
Reporter: Ignat Zapolsky
Assignee: Diego Pires Plentz
Priority: Trivial
Fix For: 3.3
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....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira