Raible's Wiki

Raible Designs
Wiki Home
News
Recent Changes

AppFuse

Homepage
  - Korean
  - Chinese
  - Italian
  - Japanese

QuickStart Guide
  - Chinese
  - French
  - German
  - Italian
  - Korean
  - Portuguese
  - Spanish
  - Japanese

User Guide
  - Korean
  - Chinese

Tutorials
  - Chinese
  - German
  - Italian
  - Korean
  - Portuguese
  - Spanish

FAQ
  - Korean

Latest Downloads

Other Applications

Struts Resume
Security Example
Struts Menu

Set your name in
UserPreferences


Referenced by
DTOInForm
StrutsResumeSupport




JSPWiki v2.2.33

[RSS]


Hide Menu

POJOsToForms


Difference between version 3 and version 2:

At line 1 changed 1 line.
This is from a [discussion|http://www.mail-archive.com/struts-user%40jakarta.apache.org/msg69836.html] on the struts-user mailing list. I'm continuing it here because I want to propose a new idea: __only converting ActionForms to POJOs__. By this, I mean to say that I'd like to retrieve and display POJOs on the UI, and capture their information (as ActionForms) when saving the form. The reason I want to do this is because of Hibernate's Lazy Loading feature. Basically, Hibernate allows you to load children of an object, i.e. Resumes of a User, when the {{getResumes()}} method is called on User.
This is from a [discussion|http://www.mail-archive.com/struts-user%40jakarta.apache.org/msg69836.html] on the struts-user mailing list. I'm continuing it here because I want to propose a new idea:
At line 3 changed 1 line.
When using BeanUtils.copyProperties() to convert a POJO to an ActionForm, the {{getResumes()}} method is called. However, I don't want this. I'd rather the getResumes() method is called when I call it in my code. Therefore, I'm thinking that passing the POJO to the view is the best solution. Because I'm using the open-session-in-view pattern, those lazy collections are still available while the JSP is being rendered.
__Send your POJOs to the UI rather than converting them to ActionForms first.__
At line 5 added 4 lines.
By this, I mean to say that I'd like to retrieve and display POJOs on the UI, and then capture their information (as ActionForms) when saving the form. The reason I want to do this is because of Hibernate's Lazy Loading feature and formatting Dates. Basically, Hibernate allows you to load children of an object lazily (i.e. resumes of a User), when the {{getResumes()}} method is called.
The issue I'm seeing right now with lazily-loaded properties is that they're loaded when using BeanUtils.copyProperties() is called. I use this to convert POJOs to ActionForms, and consequently the {{getResumes()}} method is called. However, I don't want this. I'd rather the getResumes() method is called when I call it in my code (rather than by a 3rd party conversion utility). Therefore, I'm thinking that passing the POJO to the view is the best solution. Because I'm using the open-session-in-view pattern, those lazy collections are still available while the JSP is being rendered.

Back to POJOsToForms, or to the Page History.