Thank you for your quick responses.

I cannot figure out how to produce the SelectionModel from a list of
occupations. I am not sure if I am just being dumb and have been staring at
this too long now or what:)

My method is this:

public SelectModel getOccupationModel(){
                return _session.createCriteria(Occupation.class).list();
        }

Maybe there is an easier way to get the information from occupation using
hibernate that I am missing as this seems kind of clunky compared to the
advanced nature of the beaneditform.

--James

-----Original Message-----
From: Thiago H. de Paula Figueiredo [mailto:[EMAIL PROTECTED] 
Sent: October-27-08 9:50 AM
To: Tapestry users
Subject: Re: T5: Using with hibernate and Mysql

Em Mon, 27 Oct 2008 09:42:25 -0300, James Sherwood  
<[EMAIL PROTECTED]> escreveu:

> Thank you again:)

You're welcome again! :)

> I used:
>
> @OnEvent(component = "userEditor", value=Form.PREPARE) public void
> instantiateObject() {
>               user = new User();
>       }
>
> This produces the form but without a dropdown of occupation.
> The user.occupation is just an occupation object and not a list so how do
> you handle foreign keys in beaneditform?

Inside your BeanEditForm, use something like that:

<t:parameter name="occupation">
        <select t:type="Select" t:model="occupationModel" .../>
</t:paramater>

The t:parameter tag is used by BeanEditForm to override the way some field  
is showed to the user. You can see more details at the end of  
http://tapestry.apache.org/tapestry5/tapestry-core/ref/org/apache/tapestry5/
corelib/components/BeanEditForm.html.

The Select component is just what you need to edit the occupation field  
and its documentation is here:  
http://tapestry.apache.org/tapestry5/tapestry-core/ref/org/apache/tapestry5/
corelib/components/Select.html

-- 
Thiago H. de Paula Figueiredo
Independent Java consultant, developer, and instructor
http://www.arsmachina.com.br/thiago

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


__________ Information from ESET Smart Security, version of virus signature
database 3536 (20081019) __________

The message was checked by ESET Smart Security.

http://www.eset.com

 

__________ Information from ESET Smart Security, version of virus signature
database 3536 (20081019) __________

The message was checked by ESET Smart Security.

http://www.eset.com
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to