You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by "Messing, Elad" <el...@eml-d.villa-bosch.de> on 2005/05/23 13:39:48 UTC
Selection list populated from Hibernate POJO
Hi all
It looks like a simple question, but I couldn't find the answer
for it.
I have a Hibernate POJO class - for a restaurant type. It is
actually a mapping of a look-up table from my DB. An ID, and Name
members. That's it.
Now I want to add a "Selection list" in my form, populated with
the values of this lookup table.
I wouldn't want to use the "src" type of selection list, because
that would mean setting up the XML from my hibernate class. I think this
is a waste.
Also - as it is dynamic (from the DB) I cannot use the " enum "
type (Or can I ?) .
What would you suggest will be the best why to implement this ?
Some usage of the "flow-jxpath" type ?
Thank you
Elad Messing
Software Developer
European Media Laboratory GmbH
Schloss-Wolfsbrunnenweg 33
D-69118 Heidelberg
Re: Selection list populated from Hibernate POJO
Posted by Jakub Kaniewski <jk...@egonet.pl>.
Ugo Cei wrote:
> B) possibly simpler:
>
> var form = new Form("formdef.xml");
> var list = hibernateSession.find("from ...");
> form.lookupWidget("widget-id").setSelectionList(list, "id", "name");
> form.showForm("form-template");
>
Or declare selection list as JXPath in scheme
<fd:selection-list type="flow-jxpath" list-path="RESTAURANTS"
value-path="id" label-path="name"/>
And in flowscript :
var form = new Form("formdef.xml");
var data = new Object();
data.RESTAURANTS = hibernateSession.find("from ...");
form.showForm("form-template",data);
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: Selection list populated from Hibernate POJO
Posted by Ugo Cei <ug...@apache.org>.
Il giorno 23/mag/05, alle 13:39, Messing, Elad ha scritto:
> I have a Hibernate POJO class - for a restaurant type. It is
> actually a mapping of a look-up table from my DB. An ID, and Name
> members. That's it.
Two possibilities come to mind:
A) use the src attribute and make it point to a pipeline that would
query the Hibernate datastore and output some XML. You don't have to
have Hibernate output XML, as you wrote: you can have a flowscript
function do the query and produce XML via a template page (JXTG or
Velocity). Or even an XSP page.
B) possibly simpler:
var form = new Form("formdef.xml");
var list = hibernateSession.find("from ...");
form.lookupWidget("widget-id").setSelectionList(list, "id", "name");
form.showForm("form-template");
HTH,
Ugo
--
Ugo Cei
Tech Blog: http://agylen.com/
Source.zone: http://sourcezone.info/
Wine & Food Blog: http://www.divinocibo.it/