Well, unfortunately, duty has been calling at my job for the last few
days.  So I haven't even had a chance to start it.


Here's what I was trying to get generated, the objects are loosely
defined as:

Application
   Collection getAssets();

Asset
   Application getApplication();

Where there was a 1:n relationship between Application/Asset

Assets table had a column APPLICATION_ID which was the same type as the
PK of the APPLICATION table.

This XML worked as of 2 months ago, and AFAIK, this specific syntax
hasn't changed.

Note: forign-key-mapping is the super-element of ejb-relationship-role
Note: I don't use fk-constraint because that tells jbosscmp to generate
      constraints for the FK.  Which I don't think works for all DBs
      right now

        <ejb-relation>
            <ejb-relation-name>Application-Asset</ejb-relation-name>
            <foreign-key-mapping>
                <ejb-relationship-role>
                    
<ejb-relationship-role-name>Application-has-Asset</ejb-relationship-role-name>
                    <foreign-key-fields />
                </ejb-relationship-role>
                <ejb-relationship-role>
                    
<ejb-relationship-role-name>Asset-belongsto-Application</ejb-relationship-role-name>
                    <foreign-key-fields>
                        <foreign-key-field>
                            <field-name>iD</field-name>
                            <column-name>APPLICATION_ID</column-name>
                        </foreign-key-field>
                    </foreign-key-fields>
                </ejb-relationship-role>
            </foreign-key-mapping>
        </ejb-relation>    


Does this help?

-David

On Sat, 08 Dec 2001, Dmitri Colebatch wrote:

> David/Dave,
> 
> How are you going with this?  I'm currently trying to get my head around
> it, and am having a real struggle with the relationship stuff in
> jbosscmp.  I've bought Dain's doco in the hope that would clarify things,
> but my real problem is that I haven't used cmp2's relationships, so
> playing catch up there.  atm the jbosscmp seems to generate something
> like:
> 
>       <ejb-relation>
>          <ejb-relation-name>language-languagecode</ejb-relation-name>
>                 <foreign-key-mapping>
>                     <ejb-relationship-role>
> 
> 
><ejb-relationship-role-name>one-language-has-one-languagecode</ejb-relationship-role-name>
>                         <fk-constraint>true</fk-constraint>
>                         <foreign-key-fields>
>                             <foreign-key-field>
>                                 <field-name>language</field-name>
>                                 <column-name>languageCode</column-name>
>                             </foreign-key-field>
>                         </foreign-key-fields>
>                     </ejb-relationship-role>
>                 </foreign-key-mapping>
>                 <foreign-key-mapping>
>                     <ejb-relationship-role>
> 
> 
><ejb-relationship-role-name>one-languagecode-has-one-language</ejb-relationship-role-name>
>                         <fk-constraint>true</fk-constraint>
>                         <foreign-key-fields>
>                             <foreign-key-field>
>                                 <field-name>languageCode</field-name>
>                                 <column-name>language</column-name>
>                             </foreign-key-field>
>                         </foreign-key-fields>
>                     </ejb-relationship-role>
>                 </foreign-key-mapping>
>       </ejb-relation>
> 
> the problem being the presence of two <foreign-key-mapping> elements.  The
> DTD has:
> 
> <!ELEMENT ejb-relation (ejb-relation-name,
>          (foreign-key-mapping | table-mapping))>
> 
> anyway, I'm still looking through it, and will probably continue along
> this road for a while.  I had a fairly unsuccessful attempt of finding
> previous conversations on this in the archives, so I suppose this email is
> just trying to catch up with what is known to work, and what still needs
> doing.  As I see it, jbosscmp-jdbc.xml relationships needs work (although
> I also gather the entire thing is optional from a jboss pov).
> 
> just re-read David's email below, which of course states exactly what I've
> just said... so am wondering David if you (a) have made progress here, or
> (b) could shoot me a sample of what the above _should_ look like, and I
> can take it from there...
> 
> cheers
> dim
> 
> 
> On Wed, 5 Dec 2001, Dave Smith wrote:
> 
> > 
> > 
> > David Budworth wrote:
> > 
> > > Hi all,
> > > 
> > > I'd like to add full jbosscmp-jdbc.xml abilities to xdoclet.  But
> > > first, I have a few questions:
> > > 
> > > 1) How does one add new tags to xdoclet?
> > > ie:
> > >    @jboss:relation www="xxx"
> > >                    yyy="zzz"
> > > 
> > > Similar to the weblogic support there now.
> > > 
> > 
> > 
> > > 2) Is anyone already working on this?  When I found xdoclet, I dumped my
> > > own code generation tool.  The only thing I've been missing is the
> > > jbosscmp-jdbc.xml support.  Jaws works, but the current jbosscmp xml
> > > that get's generated doesn't work at all for N:1 bi-directional
> > > relations, which I need.
> > > 
> > 
> > The standard relationship tags should work for jboss. The problem is 
> > when you are trying to define which db fields are used for the relations 
> > to override Dain's name mangling. I'll include what I have so far. I 
> > have also added the declared-sql stuff as well.
> > 
> > 
> > > 
> > > Thanks,
> > > -David
> > > 
> > > 
> > > _______________________________________________
> > > Xdoclet-devel mailing list
> > > [EMAIL PROTECTED]
> > > https://lists.sourceforge.net/lists/listinfo/xdoclet-devel
> > > 
> > 
> > 
> 
> 

_______________________________________________
Xdoclet-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-devel

Reply via email to