Thank you very much for your help.

Tutorials on this sort of thing are SO hard to find at the moment(and not be
outdated severely or just skim the very surface).

I am quite surprised at the chunkiness of foreign key manipulation when
using the beaneditform when you compare it to the gracefulness of what I
have learned in T5 so far. Maybe this sort of thing will be added to the
tapestry-hibernate libraries in the future though.

I found a nice component for using objects with a select at:
http://wiki.apache.org/tapestry/Tapestry5SelectObject
but could only get it to produce I think the object toString()(I know I
could override it in my class).  I am going to test it more though.

If anyone comes across a nice fairly in-depth tutorial on the whole
tapestry/hibernate scenario I would greatly appreciate it being sent my way
as I am about to start our next big project in T5 as opposed to our current
severely outdated use of T3:)

Thanks again,
--James


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

Em Mon, 27 Oct 2008 10:36:39 -0300, James Sherwood  
<[EMAIL PROTECTED]> escreveu:

> 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:)

Use an SelectModel implementation. You can build it yourself or use  
SelectModelImpl from Tapestry.
You'll need an OptionModel implementation too. You can build it yourself  
or use OptionModelImpl from Tapestry.

> My method is this:
>
> public SelectModel getOccupationModel(){
>               return _session.createCriteria(Occupation.class).list();
>       }

Your method would look like this (not tested):

public SelectModel getOccupationModel(){
        List<Occupation> list =
_session.createCriteria(Occupation.class).list();
        List<OptionModel> options = new ArrayList<OptionModel>();
        for (Occupation occupation : list) {
                options = new OptionModelImpl(occupation.getName(),
occupation.getId());
        }
        return new SelectModelImpl(null, options);
}


-- 
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