Hi Marcus Please find the two files attached. They're from "OOIS", which is a project previously mentioned on the list regarding CMR.
I had originally looked at the samples. In the current CVS version of the
CMR example, I couldn't find any use of fk-constraint="true". I added this
to the getCities() method of CountryBean (because it's using
target-relation, I guess I edit it there?). The generated code then
included:
<ejb-relation-name>city-country</ejb-relation-name>
<foreign-key-mapping/>
<ejb-relationship-role>
<ejb-relationship-role-name>country-has-city</ejb-relationship-role-name>
<fk-constraint>true</fk-constraint>
<key-fields>
<key-field>
<field-name>countryId</field-name>
<column-name>country_id_fk</column-name>
</key-field>
</key-fields>
</ejb-relationship-role>
<ejb-relationship-role>
<ejb-relationship-role-name>city-has-country</ejb-relationship-role-name>
<key-fields/>
</ejb-relationship-role>
</ejb-relation>
The above code doesn't generate the relationship at a table level when JBoss
runs:
09:02:52,242 INFO [JDBCInitCommand] Created table 'CUSTOMER' successfully.
09:02:52,342 INFO [EjbModule] Created
09:02:52,352 INFO [EjbModule] Starting
09:02:52,412 INFO [Language] Created table 'LANGUAGE' successfully.
09:02:52,643 INFO [AllTypesEntity] Created table 'ALLTYPES' successfully.
09:02:52,673 INFO [Address] Created table 'ADDRESS' successfully.
09:02:52,703 INFO [LanguageCode] Created table 'LANGUAGE_CODE'
successfully.
09:02:52,713 INFO [City] Created table 'CITY' successfully.
09:02:52,723 INFO [City] Created table 'CITY_LANGUAGES_LANGUAGE_CITIES'
success
fully.
09:02:52,753 INFO [Country] Created table 'COUNTRY' successfully.
If I manually move the <fk-constraint>true</fk-constraint> from
country-has-city to city-has-country, JBoss tries to create the foreign key
in the table (but because it's Hypersonic by default we can't complete the
FK test - and pointing the datasource to something else like SapDB stops the
deployment because of duplicate column names):
09:05:22,759 ERROR [EjbModule] Starting failed
java.lang.IllegalStateException: Foreign key constriant is not allowed for
this
type of datastore
at
org.jboss.ejb.plugins.cmp.jdbc.JDBCStartCommand.addForeignKeyConstrai
nt(JDBCStartCommand.java:354)
Thanks very much for taking a look at this!
Ben
----- Original Message -----
From: "Marcus Brito" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, September 19, 2002 4:10 AM
Subject: Re: [Xdoclet-user] JBoss 3 with cmr fk-constraint - works with
1.1.2 but not CVS
> Ben Alex wrote:
>
> > Hi
> >
> > I am having a problem with <fk-constraint> appearing in the wrong
location
> > when using the current CVS. When using XDoclet 1.1.2, the same XDoclet
tags
> > work fine.
>
> Hello, Ben. Strangest it may be, the xdoclet samples have a similar case
> that works fine. Could you send me the complete source to these beans so
> I can set up a full test case here?
>
> --
> MB
>
>
>
>
> -------------------------------------------------------
> This SF.NET email is sponsored by: AMD - Your access to the experts
> on Hammer Technology! Open Source & Linux Developers, register now
> for the AMD Developer Symposium. Code: EX8664
> http://www.developwithamd.com/developerlab
> _______________________________________________
> Xdoclet-user mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/xdoclet-user
>
EventBean.java
Description: java/
CompetitionBean.java
Description: java/
