Hi Ghislain
Try this for your newlink
<li><a class="newlink" href="#" jwcid="@trails:NewLink"
type="ognl:@vu.gov.departmentcooperative.Person@class"
associationDescriptor="ognl:classDescriptor.getPropertyDescriptor('members')"
parent="ognl:model">Add a New Member</a></li>
This was meant to be used with child collections (aka: compositions)
but it may work in your case too.
Let me know if it works (or if it doens't).
Saludos.
Alejandro.
--
Alejandro Scandroli -
http://weblog.amneris.es/Amneris: We build process-driven web applications.
http://www.amneris.esOn Tue, Dec 16, 2008 at 7:00 AM, ghachey <
ghachey@...> wrote:
>
> Hi,
>
> I'm very new to trails, and tapestry and hibernate too by that matter. I'm
> evaluating trails but I have been blocked on this problem for a few days
> now.
>
> I have a Society entity and a Person entity. They are linked with a
> ManyToMany relationship like follows in Society.java:
>
> @PropertyDescriptor(index = 14, searchable = false, summary = false)
> @ManyToMany(
> targetEntity = vu.gov.departmentcooperative.Person.class,
> cascade = {CascadeType.PERSIST, CascadeType.MERGE}
> )
> @JoinTable(
> name = "society_person",
> joinColumns = @JoinColumn(name = "society_id"),
> inverseJoinColumns = @JoinColumn(name = "person_id")
> )
> public List<Person> getMembers() {
> return members;
> }
>
> public void setMembers(List<Person> newMembers) {
> this.members = newMembers;
> }
>
> The default look for this type of field when editing a Society is to use a
> palette component. I changed this to include a TableObject of members
> (Person.java) belonging to that particular society like follows:
>
> <form jwcid="@trails:ObjectForm" model="ognl:model">
> <!-- Custom look (component) for members attribute -->
> <div id="members">
> <div id="left" style="float:left;" jwcid="members@Block">
> <li><label class="desc">Members</label>
> <table class="table contribTable" jwcid="@trails:ObjectTable"
> rowsClass="ognl:beans.evenOdd.next"
> instances="ognl:model.members"
> classDescriptor="ognl:page.descriptorService.getClassDescriptor(classDescriptor.getPropertyDescriptor('members').elementType)"/>
> </li>
> </div>
> <div id="right" jwcid="@If" condition="ognl:classDescriptor.allowSave">
> <li>
> a class="newlink" href="#" jwcid="@trails:NewLink"
> type="ognl:@vu.gov.departmentcooperative.Person@class">Add a New Member
> </li>
> </div>
> </div>
> </form>
>
> This obviously adds a new Person in the database but not specific to the
> Society I had opened for edit (or any Society at all). In other words, it
> does not update the ManyToMany's JoinTable (society_person).
>
> image for clarity.
>
>
http://www.nabble.com/file/p21027777/pic.png>
> Can someone help me out?
>
> --
> Ghislain Hachey
> --
> View this message in context:
http://www.nabble.com/ManyToMany-Custom-Look-tp21027777p21027777.html> Sent from the Trails - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>
http://xircles.codehaus.org/manage_email>
>
>
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email