You didn't post any code, and since you're a beginner, a simple
illustrative example would probably be a good idea anyway. So, in your
Company EJB code you shouldn't need anything[0] (as you'd expect, since
it has no knowledge of the Store EJB). Simple enough. Now, in
StoreEJB.java you're going to have something like this:

/**
 * @ejb.bean name="Store"
 *      type="CMP"
 *      cmp-version="2.x"
 *      view-type="local"
 *      local-jndi-name="ejb/StoreLocal"
 *      primkey-field="storeId"
 */
public abstract class StoreEJB implements EntityBean
{

/**
 * @ejb.persistence
 *      column-name="STORE_ID"
 */
public abstract String getStoreId();

public abstract setStoreId(String storeId);


/**
 * @ejb.relation
 *      name="Company-Store"
 *      role-name="Store-BelongsTo-Company"
 *      target-ejb="Company"
 *      target-role-name="Company-Has-Stores"
 *      target-multiple="yes"
 */
public abstract CompanyLocal getCompany();

public abstract void setCompany(CompanyLocal company);
}

That's it. Now, this assumes you've got your build.xml file configured
correctly. If not, feel free to write back. 

-- Jon Olson

[0] That is, anything beyond your basic EJB setup stuff. See the above
for a fairly generic example. 

On Sat, 2004-04-17 at 19:07, beginner wrote:
> Hi,
> i'm a beginner in xdoclet, so my question is really
> simple, but...
> I got two CMPs that are mapped one-to-one on my
> database tables.
> 
> -Table Company has COMPANY_ID as its PK (does NOT 
>  reference table Store)
> -Table Store has STORE_ID as it's PK and COMPANY_ID as
>  it's FK
> 
> The relationship is the following
> - 1 company has 1..N stores
> - 1 store always belong to 1 company




-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
xdoclet-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-user

Reply via email to