Daniel Pinheiro a écrit :
How can i use palette with data from DataBase? Can someone help me?
I had some troubles with JPA too. If you use one request to retrieve all elements and another one for selected elements, it will not be same instances in both case.
So for each Palette,  I have specified :
- a "model" : getter returning array Entity[] with all my entities
- a "selected" : returning a private List<Entity> containing all selected elements. This property has getter setter and @Persist annotation. This list is initialized when page is setup for user. Elements in this list are not same instances as in "model"

You also have to code a subclass of ValueEncoder<Entity>. toClient returns the id of Entity, and toValue retrieve entity from database. You can contribute this in contributeValueEncoderSource of your --App--Module. But as you have lists, encoder can not be found from object class. So :

- an "encoder" : returning instance of your ValueEncoder subclass.

Finally, as selected items are removed from available items in display, it finds your elements in a hashmap. So you have to implement hashCode (and equals?) in Entity.

It should work then. I'm using facilities of JPA/Hibernate, so if you use plain old JDBC, I have no idea of how it can work...

References :
<http://tapestry.formos.com/nightly/tapestry5/tapestry-core/ref/org/apache/tapestry/corelib/components/Palette.html>
<http://www.hibernate.org/109.html>
<http://www.nabble.com/Re%3A--T5--Select%2C-palette%2C-multiselect-p11886311.html>

It would be a great page for wiki, at least if it is not wrong!

Gabriel

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

Reply via email to