Try the following. It's not automatic but should provide the desired behaviour.
private EntityType entity;
@Inject
private Session session;
void onActivate(String searchString)
{
this.entity = (EntityType) Session.createQuery("from EntityType e where
e.field=:searchString").setParameter("searchString", searchString).uniqueResult();
}
Cheers,
Uli
Angelo Chen schrieb:
Hi,
I like the feature that we can now pass Hibernate entity to the onActivate
and T5 automatically picks up object from database. however it assumes what
passed is the primary key, example:
1. this works.
localhost://page/1
2. this will not work:
localhost://page/myName
is there a way to tell T5 that to use a particular field to pick up the
object?
thanks,
sample code follows:
public class Page
{
private Person person;
void onActivate(Person person)
{
this.person = person;
}
Object onPassivate()
{
return this.person;
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]