-
1. Re: Any jbosscmp-jdbc.xml example out there?
alu1344 Sep 11, 2001 5:36 PM (in response to alu1344)Ok, please stop replying to mi message, you noisy crowd ;)
There is one "example" in the conf/default directory, named standardjbosscmp-jdbc.xml
If you adhere to the same sintax and think a bit on your own the rest is easy.
And it's only 22:34 in my local time - tonight I'm gonna sleep :))) -
2. Re: Any jbosscmp-jdbc.xml example out there?
dbudworth Oct 5, 2001 3:33 PM (in response to alu1344)So, any possiblity of sharing the magic trick to this?
I can get all my beans to deploy, but only as long as there are no CMR fields. If I have the CMR descriptions in ejb-jar.xml, jboss chokes at deployment time at JDBCRelationshipRoleMetaData.java:95
with a null pointer.
I also removed jaws.xml, and it seems to be ok, though oddly enough, my beans deploy without error, even though I have yet to add the data source they reference.
So I have jbosscmp-jdbc.jar, ejb-jar.xml, and jboss.xml.
Do relations HAVE to be declared in jbosscmp-jdbc.jar? The docs say no.
Could you possibly provide the relation bits from the xml files?
Or, did you not do CMR yet? And were only trying to deploy ejb2 beans? -
3. Re: Any jbosscmp-jdbc.xml example out there?
alu1344 Oct 5, 2001 7:55 PM (in response to alu1344)search on the forums, there are examples of many-2-many and one-2-many relations.
You don't need to specify the fields in jbosscmp-jdbc, but then the database column names are generated automatically (let jboss generate your tables to see the names chosen). You have to specify them on jbosscmp-jdbc.xml to force your names.
On ejb-jar:
...
</enterprise-beans>
<!-- Albaran -->
<ejb-relation>
<ejb-relation-name>Albaran-LineaAlbaran</ejb-relation-name>
<ejb-relationship-role>
<ejb-relationship-role-name>Albaran-has-LineaAlbaran</ejb-relationship-role-name>
One
<relationship-role-source>
<ejb-name>Albaran</ejb-name>
</relationship-role-source>
<cmr-field>
<cmr-field-name>lineasAlbaran</cmr-field-name>
<cmr-field-type>java.util.Collection</cmr-field-type>
</cmr-field>
</ejb-relationship-role>
<ejb-relationship-role>
<ejb-relationship-role-name>LineaAlbaran-belongsto-Albaran</ejb-relationship-role-name>
Many
<relationship-role-source>
<ejb-name>LineaAlbaran</ejb-name>
</relationship-role-source>
<cmr-field>
<cmr-field-name>albaran</cmr-field-name>
</cmr-field>
</ejb-relationship-role>
</ejb-relation>
...
On jbosscmp-jdbc:
...
</enterprise-beans>
<!-- Albaran -->
<ejb-relation>
<ejb-relation-name>Albaran-LineaAlbaran</ejb-relation-name>
<foreign-key-mapping>
<ejb-relationship-role>
<ejb-relationship-role-name>Albaran-has-LineaAlbaran</ejb-relationship-role-name>
<foreign-key-fields/>
</ejb-relationship-role>
<ejb-relationship-role>
<ejb-relationship-role-name>LineaAlbaran-belongsto-Albaran</ejb-relationship-role-name>
<foreign-key-fields>
<foreign-key-field>
<field-name>id</field-name>
<column-name>ALB_ID</column-name>
</foreign-key-field>
</foreign-key-fields>
</ejb-relationship-role>
</foreign-key-mapping>
</ejb-relation>
...