Hi all,
I posted a similar question about the same issue in the Hibernate forum but want to see what
Struts programmers think.
My issue is this: I have a database table, say "Persons," that has a one-to-many relationship with other tables, say "PhoneNumbers" and "Emails" what I am trying to do (and what I thought using Hibernate and Struts2 together would accomplish) is to be able to generate XML over HTTP output in which the entries are nested, something like this:
There does not seem to be an easy way to do this in Struts2 beyond running separate "PhoneNumber" and "Email" queries against the database for every single person and then loading the results into Lists, Hashmaps or the like after each query, what seems like a very slow, bloated and inefficient way to do things if we are talking about a database with hundreds of thousands of people. In order to find a more elegant solution I tried using Hibernate in conjunction with Struts2; Hibernate automatically built my DAO classes, and it uses Set objects to hold the "PhoneNumbers" and "Email" objects that are related to a particular "Persons" instance. However, it seems that the Struts2 XSLT result type cannot handle these Set objects; I merely get an unhandled exception when the xml is being transformed, whereas the result works fine if I remove the Set objects.
So, what is the easiest/best/most preferred way to build more complex XML output in Struts2
Thanks!