I have a classic 1->N unidirectional relationship such as Set has N Entries.

setTable                   entriesTable
============       ==================
id      long PK    setID       long      PK and FK
type    int        entryName   varchar  PK

SetBean.java
----------------------------------
public SetPK ejbCreate(long id, int type, Collection entryVOs) {
    setId(id);
    setType(type);
    return null;
}

public void ejbPostCreate(long id, int type, Collection entryVOs) {
    Iterator entryIter = entryVOs.iterator();
    while (entryIter.hasNext()) {
        SetEntryVO entryVO = (SetEntryVO) entryIter.next();
        SetEntryLocal entry = entryHome.create(id, entryVO.getName());
        // OR should I only pass the name into create(),
        // the next step would usually setup the FK in entriesTable
        // but we did it in the above creation?
        getEntries().add(entry);
    }
}

SetEntryBean.java
--------------------------------
public SetEntryPK ejbCreate(long id, String name) {
    setId(id);
    setName(name);
}

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to