Did you get this solved? Have you tried writing a DaoTest that
verifies the behavior you're seeing?

Matt

On 2/10/07, 23455432 <[EMAIL PROTECTED]> wrote:

I have a user object with whom i would like to relate multiple "persons" that
contain some trivial information. I am new to the whole appfuse/webdev. This
is what I have done so far:

Added a set of persons (i call them contacts) to the user doing the
following:

  /**
     * @hibernate.set table="user_person" lazy="false" cascade="save-update"
     * @hibernate.collection-key column="user_id"
     * @hibernate.collection-one-to-many class="org.appfuse.model.Person"
column="person_id"
     */
    public Set getContacts(){
        return this.contacts;
    }

    public void setContacts(Set contacts){
        this.contacts = contacts;
    }

    public void addContact(Person contact){
        getContacts().add(contact);
    }


    public List getContactList(){
        List userContacts = new ArrayList();

        if(this.contacts != null){
                for(Iterator it = contacts.iterator(); it.hasNext();){
                        Person person = (Person) it.next();
                        userContacts.add(new LabelValue(person.toString(),
person.toString()));
                        System.out.println("adding " + person.toString());
                }
        }
        System.out.println("returning contacts");
        return userContacts;
    }



Now I need to access the contacts. I see the getContactList function being
called, but the contacts list is always empty... I am not sure why. Any help
and direction would be appreciated.
--
View this message in context: 
http://www.nabble.com/One-to-many-mapping-question-tf3207216s2369.html#a8906440
Sent from the AppFuse - User mailing list archive at Nabble.com.

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




--
http://raibledesigns.com

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

Reply via email to