How to get more detail on a list selection

"Rick Reumann" <[email protected]> Wed, 14 May 2003 11:31:09 -0400
Newsgroups gmane.comp.java.mvc.devel
Organization baseBeans Engineering
Message-ID <[email protected]>
How would you accomplish the following...


I have a ProjectBean(BaseBean) which is used to hold the 'typical' project
information that I like to display in a table (ie Title, Description,
Status, Priority, Date Requested, Contact, etc.). Everything is fine with
the above.

I then want to be able to click on the project name and brought to a
"details" page that not only displays the above information but then also
will display a list of "notes" - notes are just entered in note entries
into a separate table. Also I could forsee displaying other detail
information from another table such as status change history.

What is the best way to handle the above? Assuming I already have a
NoteBean, do I need to build another bean ProjectDetailBean that in Ibatis
will map to NoteBean to populate the NoteBean into ProjectDetailBean?
Really all I need is the one Row from the ProjectBean and then a query to
NoteBean based on projectId, but is there really doesn't seem to be a
place for this type of behvior to take place in the BaseBeans approach. I
suppose I could modify one of the actions to create a NoteBean instance
and then call populate(long id) and then put the NoteBean in scope.... but
you seem to be against that. Maybe just creating another bean
ProjectDetailBean is the best way to go?

If I do create a ProejectDetailBean, I'm having a difficult time with
Ibatis trying to figure out how to have it populate ProjectDetailBean. In
other words ProejctDetailBean really only needs :

ProjectBean projBean;
NoteBean noteBean;

//get and sets to get and set HashMap with the above beans

But then the question is how do I populate this in Ibatis?

It looks like I'd want to do something like...

<result-map name="resultDetail" class="projectUtility.ProjectBean">

<property name="noteBean" column="projectId"
mapped-statement="NoteSelectAll"/>

<property name="projectBean" column="projectId"
mapped-statement="ProjectSelectOne"/>

</result-map>


but then I also need a mapped statement to call:

<mapped-statement   name="ProjectDetail"  result-map="resultDetail"
cache-model="project_cache" inline-parameters="true">
        //really I don't need anything called here - because I just
	//want "resultDetail" to get called, but it looks like you
	//need some statement here?
</mapped-statement>


Basically I'd like to call the mapping "ProjectDetail" which in turn would
call NoteSelectAll and ProjectSelectOne, but I can't get this to work.


How do you handle this under a BaseBeans framework?

Thanks,

-- 
Rick