Hi,
In some of the code of my application, the Native SQL is required somehow so that I could use the xpath syntax to search a XML column in our Ms SQL database. And in the Native SQL I need to return a list with multitple entities.
From the url
http://docs.jboss.org/hibernate/core/3. ... l#d0e13763, I able to find a sample of adding multiple entities into a single native SQL with below code:
String sql = "SELECT ID as {c.id}, NAME as {c.name}, " +
"BIRTHDATE as {c.birthDate}, MOTHER_ID as {c.mother}, {mother.*} " +
"FROM CAT_LOG c, CAT_LOG m WHERE {c.mother} = c.ID";
List loggedCats = sess.createSQLQuery(sql)
.addEntity("cat", Cat.class)
.addEntity("mother", Cat.class).list()
However I am wondering after we get the returned list, how should we further parse the list element into entities "cat" and "mother" ?
Appreciate if somebody could gimme some guidance.
Thanks.