> Not sure what you mean by "removing the Hibernate mapping of
> parent -> child.", but here is my simple suggestion: -
>
In this case, the User is the parent, and Resumes are its children. The
following mapping tells Hibernate to only load the user's resumes
(meaning: execute the SQL) when the "getResumes()" method is called.
Notice lazy="true".
/**
* Returns the resumes.
* @return List
*
* @hibernate.bag name="resumes" table="resume" cascade="none"
inverse="true"
* lazy="true"
* @hibernate.collection-key column="id"
* @hibernate.collection-one-to-many
class="org.appfuse.persistence.Resume"
*/
public List getResumes() {
return resumes;
}
> Place another method like "getUserDetailsLazily(...)". This
> one will duplicate the attributes of just Users to UserForm
> and leave out on List attributes like UserRoles & Resumes.
> Nullify them in the UserForm or something.
>
> And when on the web front checks that UserForm.getResume is
> null, they would have to resort to getting it from your
> existing service at ResumeManager.getResumesForUser(...).
> This solution is do-able, but seems like it's defeating the
> purpose of having a relationship in the object model? . Thank you.
>
I expect to use this application (someday) to host my resume, and I
doubt that most users will have more than 3 resumes, so I'm not
concerned with the performance. The easiest thing to do would be to
remove the resumes property (plus get/set) from User, and not use it -
especially since I'm getting a user's resumes via other means.
Glad you like the app. I actually wrote it for Professional JSP 2.0
(Wrox) - before they went under. Now the book has been bought by Apress
and will (hopefully) be published this summer. One chapter I wrote
explains the XDoclet/Struts semantics in detail. Most technical books
I've read ship with a sample app that is uterly unusable. Therefore, I
wanted to create something that people could actually use to start their
projects. It's working great for me so far.
HTH,
Matt
-------------------------------------------------------
This SF.Net email is sponsored by: INetU
Attention Web Developers & Consultants: Become An INetU Hosting Partner.
Refer Dedicated Servers. We Manage Them. You Get 10% Monthly Commission!
INetU Dedicated Managed Hosting http://www.inetu.net/partner/index.php
_______________________________________________
Struts-apps mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/struts-apps