Hi,

I'm currently using Jboss 3.2.1 and xdoclet-1.2b.

I'm just starting to move fully towards migrating our EJB 1 
beans into the EJB 2 world with container managed relationships, etc.

I've got some early relationships working, but  have run into
a problem.  I'm not sure if it's what xdoclet is doing or
if it's the CMP engine of Jboss.  

What I really want to know is: can I have an accessor for a
foreign key, as well as an accessor for the relationship 
which maps to that  key?

For example, consider CityBean and StateBean (pkey=STATE_ID)

If cityBeans is a simple table: 
create table city ( city_id integer, name varchar, state_id integer)
create table state (state_id integer, name varchar)

WOuld it be possible to have in CityBean:

/**
 * @ejb.persistence column-name="STATE_ID"
 * @ejb.interface-method
 */

public abstract Integer getStateId();

and 


/**
 * @ejb.relationship ... etc...
 *
 * @jboss.relation
 *      fk-column="STATE_ID"
 *      related-pk-field="stateId"
 */
public abstract CityLocal getState();



Judging from the debugging output of jboss, it duplicates the
state_id column both in ejbLoad and ejbStore for this.  The only reason
that I ask this is -  in certain cases, the foreign key itself is enough
information - I don't want to trigger another query to load up the 
state bean via the relationship.

Maybe it would be enough not to have a setStateId(Integer)?  But then
it would  read that column twice in the ejbLoad....

Any ideas?

-- 
Russell Chan
Stable Network Technologies Inc.
PO Box 86079 
Oakville, Ontario, Canada
L6H 5V6

Email: [EMAIL PROTECTED]
Mobile: 416 822 5200
Fax: 416 867 7170


-------------------------------------------------------
This SF.NET email is sponsored by: eBay
Great deals on office technology -- on eBay now! Click here:
http://adfarm.mediaplex.com/ad/ck/711-11697-6916-5
_______________________________________________
xdoclet-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-user

Reply via email to