Hi Mick,

I feel your pain -- hang in there! You have one cut-n-paste error that I
spotted. Your Allergies bean lists itself as the target-ejb:

AllergiesBean:
=============================
     * @ejb.relation
     *      name="MedicalHistory-Allergies"
     *      role-name="allergies-belongs_to-medical_history"
     *      target-ejb="Allergies"

I'm not using any 1-to-1 relationships here, but another team is. I
remember him muttering something about having issues with it in regards
to value objects. In this case, however, it seems you're just trying to
get the relation itself to work, yes?

Also, I don't know how the Jboss tags work, but with WebLogic I specify
the foreign-key-column and key-column both using the names in the DB. In
your code you have one specified using the DB column name and the other
using the abstract schema name. Is this how it should be done?

My teammate confirmed that he had issues getting 1-to-1 bi-directional
relationships working at all. Some points: 1. His objects' names were
both singular (that shoots down my theory that something is getting
confused by seeing the "-s" which would be lame). 2. He never tried
unidirectional. 3. He suspected the value object wasn't working but
later confirmed that it was the relation itself. 4. He never tried doing
it manually without Xdoclet, so he has no idea if it's WebLogic or
Xdoclet or Mimi Rogers. He thinks it's Xdoclet, but I'm not ready to
discount Mimi's hand in all this.

His solution? Implement it as a 1-to-N relationship and add code to
enforce that there be only one child. A hack, yes, but it's working and
he's moved on.

Good luck!

David Harkness
Sony Pictures Digital Networks

-----Original Message-----
From: Mick Knutson [mailto:[EMAIL PROTECTED] 
Sent: Friday, June 27, 2003 9:32 AM
To: [EMAIL PROTECTED]
Subject: Re: AW: [Xdoclet-user] 1-1 unidirectional relationship issue


Well, as I have been frustrated trying to get this to work, I switched
this 
to a 1-1 bi-directional relationship. But I still can't get this to
work. I 
really don't know why, because I have another 1-M bi-directional that
seems 
to work fine.
I can't use the finder as there is _not_ a cmp attribute on Allergies 
anymore.

Here is what I have now:
===============

MedicalHistoryBean:
=============================
    /**
     * Get Allergies for this medicalHistory.
     *
     * @ejb.interface-method
     *
     * @ejb.relation
     *      name="MedicalHistory-Allergies"
     *      role-name="medical_history-has-allergies"
     *      target-ejb="Allergies"
     *      --target-role-name="allergies-belongs_to-medical_history"
     *      --target-cascade-delete="yes"
     *
     * @ejb.value-object
     *      compose="com.baselogic.yoursos.user.AllergiesDto"
     *      compose-name="AllergiesDto"
     *      members="com.baselogic.yoursos.user.AllergiesLocal"
     *      members-name="AllergiesDto"
     *      relation="external"
     *
     * @ --jboss.relation
     *      --fk-column="allergies_id_fk"
     *      --related-pk-field="medicalHistoryId"
     *      --fk-contraint="true"
     */
    public abstract AllergiesLocal getAllergies();
    public abstract void setAllergies( AllergiesLocal pAllergiesLocal );


AllergiesBean:
=============================
    /**
     * Get the MedicalHistory for this Allergies
     *
     * @ejb.interface-method
     *
     * @ejb.relation
     *      name="MedicalHistory-Allergies"
     *      role-name="allergies-belongs_to-medical_history"
     *      target-ejb="Allergies"
     *
     * @jboss.relation
     *      fk-column="medical_history_id_fk"
     *      related-pk-field="medicalHistoryId"
     *      fk-contraint="true"
     **/
        public abstract MedicalHistoryLocal getMedicalHistory();
        public abstract void setMedicalHistory( MedicalHistoryLocal
pMedicalHistory 
);


ALLERGIES_TABLE:
=============
allergies_id: varchar
medical_history_id_fk: varchar
......more attributes...

MEDICAL_HISTORY_TABLE:
==================
medical_history_id: varchar
user_id_fk: bigint




---
Thanks...
Mick Knutson
---





>From: "Ingo Bruell" <[EMAIL PROTECTED]>
>Reply-To: [EMAIL PROTECTED]
>To: [EMAIL PROTECTED]
>Subject: AW: [Xdoclet-user] 1-1 unidirectional relationship issue
>Date: Fri, 27 Jun 2003 14:02:42 +0200
>
>-----BEGIN PGP SIGNED MESSAGE-----
>Hash: SHA1
>
>Hi Mick,
>
> > I am still having an issue here.
> > I have now been working on this for about 3 solid days now. Please 
> > help!
> >
> > I get the Allergies created as well as the MedicalHistory object in 
> > the
>DB,
> > but the Allergies does not have a medical_history_id_fk so I have no

> > way
>to
> > find that Allergies from the Medical HistoryID.
>
>You need a finder to get it, something like:
>
>@ejb.finder signature="..."
>             query="SELECT OBJECT(o) FROM Allergies as o WHERE 
>o.medicalHistory.id = ?1"
>
>
>best regards
>
>Ingo Bruell
>
>- - ---
><[EMAIL PROTECTED]>
><ICQ# 40377720>
>Oldenburg  PGP-Fingerprint: CB01 AE12 B359 87C4 BF1C  953C 8FE7 C648 
>169E
>E5FC
>Germany    PGP-Public-Key available at pgpkeys.mit.edu
>
>-----BEGIN PGP SIGNATURE-----
>Version: PGPfreeware 6.5.8 for non-commercial use <http://www.pgp.com>
>
>iQA/AwUBPvwj/4/nxkgWnuX8EQJYlwCgkeSuc/FprhKdGRAij9N5BQ9BwekAn1/V
>ylVTbXZab7UQNq0MP9YLFnWp
>=tijH
>-----END PGP SIGNATURE-----
>
>
>
>
>-------------------------------------------------------
>This SF.Net email is sponsored by: INetU
>Attention Web Developers & Consultants: Become An INetU Hosting 
>Partner. Refer Dedicated Servers. We Manage Them. You Get 10% Monthly 
>Commission! INetU Dedicated Managed Hosting 
>http://www.inetu.net/partner/index.php
>_______________________________________________
>xdoclet-user mailing list
>[EMAIL PROTECTED]
>https://lists.sourceforge.net/lists/listinfo/xdoclet-user

_________________________________________________________________
MSN 8 with e-mail virus protection service: 2 months FREE*  
http://join.msn.com/?page=features/virus



-------------------------------------------------------
This SF.Net email is sponsored by: INetU
Attention Web Developers & Consultants: Become An INetU Hosting Partner.
Refer Dedicated Servers. We Manage Them. You Get 10% Monthly Commission!
INetU Dedicated Managed Hosting http://www.inetu.net/partner/index.php
_______________________________________________
xdoclet-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-user


-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100006ave/direct;at.asp_061203_01/01
_______________________________________________
xdoclet-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-user

Reply via email to