Hmm... not sure why I said loop. If you provide an "encoder" to your loop, select will use that Should be If you provide an "encoder" to your select, it will use that.
If company is in the basepackage.entities package, then tapestry-hibernate will auto-register a ValueEncoder for it. On 2 December 2013 19:31, Boris Horvat <horvat.z.bo...@gmail.com> wrote: > Hi to both of you :) > > I don't have a loop, I just a have a simple Select component that I want to > use so I was expecting that tapestry-hibernate will provide one for me. > However to my suprise this didnt work :( > > (Thiago) I know that SelectModel doesnt deal with id's that is why I said > SelectModelFactory. What I am thinking is that the factory will create a > model that will use the id of the entity as a value for the selection > option, however for some reason it is using output of toString. > > I guess I could provide SelectModel of my own and populate correct values, > however I would like to use out-of-the-box options that work for other > classes of mine > > here is my code > > <t:select t:id="selectField" t:value="selectValue" t:blankOption="never" > t:model="model" /> > > public SelectModel getModel() { > return modelFactroy.create(listOfCompanies), "name"); > } > > listOfValues contain objects that have > > @Entity > @XmlRootElement > public class Company implements Serializable{ > > @Id > @GeneratedValue > private Long id; > @Column(name = "Name") > private String name; > > .... > > > On Mon, Dec 2, 2013 at 11:57 AM, Thiago H de Paula Figueiredo < > thiag...@gmail.com> wrote: > > > On Sun, 01 Dec 2013 19:39:24 -0200, Boris Horvat < > horvat.z.bo...@gmail.com> > > wrote: > > > > Hi everyone, > >> > > > > Hi! > > > > > > I am confused by the SelectModelFactory and how it picks an id. I have a > >> code > >> > > > > SelectModel doesn't deal with ids at all. It deals with what the options > > are and what their labels are. Ids are handled by ValueEncoder, passed > > explicitly through the 'encoder' parameter of components like Select and > > Palette or automatically by contributing to the ValueEncoderFactory > service. > > > > -- > > Thiago H. de Paula Figueiredo > > Tapestry, Java and Hibernate consultant and developer > > http://machina.com.br > > Help me spend a whole month working on Tapestry bug fixes and > > improvements: http://igg.me/at/t5month > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > > For additional commands, e-mail: users-h...@tapestry.apache.org > > > > > > > -- > Sincerely > *Boris Horvat* >