This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes JBoss/WildFly and the fly likes jbosscmp-jdbc.xml nexus with ejb-jar.xml Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "jbosscmp-jdbc.xml nexus with ejb-jar.xml" Watch "jbosscmp-jdbc.xml nexus with ejb-jar.xml" New topic
Author

jbosscmp-jdbc.xml nexus with ejb-jar.xml

Mundra Priyank
Greenhorn

Joined: Jun 07, 2006
Posts: 8
when i am trying to use entity beans (ejb2.1) ,my jbosscmp-jdbc.xml is not bieng read by jboss...i am sure as a websphere...there is some element tag in ejb-jar.xml for specifying the name of jbosscmp-jdbc.xml file...can sum one give me that...an example wld be great .attached is my ejb-jar.xml and jdbcmpjdbc.xml
===========================================================================
<?xml version="1.0" encoding="UTF-8"?>
<ejb-jar id="ejb-jar_ID" version="2.1" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd">
<display-name>
SessionStrutsEJB
</display-name>


<enterprise-beans>

<!-- A minimal session EJB deployment -->
<session>
<ejb-name>AuthenticationEJB</ejb-name>

<home>com.library.ejb.AuthenticationHome</home>
<remote>com.library.ejb.AuthenticationRemote</remote>
<ejb-class>com.library.ejb.AuthenticationBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
</session>


<entity>
<ejb-name>CategoryEntityBean</ejb-name>
<home>com.library.ejb.CategoryEntityHome</home>
<remote>com.library.ejb.CategoryEntityRemote</remote>
<ejb-class>com.library.ejb.CategoryEntityBean</ejb-class>
<persistence-type>Container</persistence-type>
<prim-key-class>java.lang.Integer</prim-key-class>
<reentrant>false</reentrant>
<cmp-version>2.x</cmp-version>
<abstract-schema-name>CategoryEntityBean</abstract-schema-name>

<cmp-field><field-name>desc</field-name></cmp-field>
<cmp-field><field-name>name</field-name></cmp-field>
<cmp-field><field-name>category_id</field-name></cmp-field>

<primkey-field>category_id</primkey-field>
</entity>
<entity>
<ejb-name>BookEntityBean</ejb-name>
<local-home>com.library.ejb.BookEntityLocalHome</local-home>
<local>com.library.ejb.BookEntityLocal</local>
<ejb-class>com.library.ejb.BookEntityBean</ejb-class>
<persistence-type>Container</persistence-type>
<prim-key-class>java.lang.Integer</prim-key-class>
<reentrant>false</reentrant>
<cmp-version>2.x</cmp-version>
<abstract-schema-name>BookEntityBean</abstract-schema-name>

<cmp-field><field-name>desc</field-name></cmp-field>
<cmp-field><field-name>name</field-name></cmp-field>
<cmp-field><field-name>book_id</field-name></cmp-field>

<primkey-field>book_id</primkey-field>
</entity>
</enterprise-beans>

<relationships>
<ejb-relation>
<ejb-relation-name>category-book</ejb-relation-name>
<ejb-relationship-role >
<ejb-relationship-role-name>Category-has-Book</ejb-relationship-role-name>
<multiplicity>Many</multiplicity>
<relationship-role-source>
<ejb-name>CategoryEntityBean</ejb-name>
</relationship-role-source>
<cmr-field>
<cmr-field-name>books</cmr-field-name>
<cmr-field-type>java.util.Set</cmr-field-type>
</cmr-field>
</ejb-relationship-role>
<ejb-relationship-role >
<ejb-relationship-role-name>Book-in-Category</ejb-relationship-role-name>
<multiplicity>One</multiplicity>
<relationship-role-source>
<ejb-name>BookEntityBean</ejb-name>
</relationship-role-source>
</ejb-relationship-role>
</ejb-relation>


</relationships>



<assembly-descriptor>






</assembly-descriptor>
</ejb-jar>
==========================================================================
<?xml version='1.0' encoding='UTF-8' ?>

<!--
This is the XML DTD for the jbosscmp-jdbc deployment descriptor.
<!DOCTYPE jbosscmp-jdbc PUBLIC
"-//JBoss//DTD JBOSSCMP-JDBC 4.0//EN"
"http://www.jboss.org/j2ee/dtd/jbosscmp-jdbc_4_0.dtd">
-->
<jbosscmp-jdbc>
<entity>


<ejb-name>CategoryEntityBean</ejb-name>
<datasource>java:MySqlDS</datasource>
<table>categ</table>
<cmp-field>
<field-name>desc</field-name>
<column-name>category_desc</column-name>
</cmp-field>

<cmp-field>
<field-name>name</field-name>
<column-name>category_name</column-name>
</cmp-field>

<cmp-field>
<field-name>category_id</field-name>
<column-name>category_id</column-name>
</cmp-field>
</entity>


<entity>


<ejb-name>BookEntityBean</ejb-name>
<datasource>java:MySqlDS</datasource>
<table>book</table>
<cmp-field>
<field-name>desc</field-name>
<column-name>book_desc</column-name>
</cmp-field>

<cmp-field>
<field-name>name</field-name>
<column-name>book_name</column-name>
</cmp-field>

<cmp-field>
<field-name>book_id</field-name>
<column-name>book_id</column-name>
</cmp-field>



</entity>


<relationships>
<ejb-relation>
<ejb-relation-name>category-book</ejb-relation-name>
<relation-table-mapping>
<table-name>category_name</table-name>
<datasource>java:MySqlDS</datasource>
</relation-table-mapping>
<ejb-relationship-role>
<ejb-relationship-role-name>Category-has-Book</ejb-relationship-role-name>
<key-fields>
<key-field>
<field-name>category_id</field-name>
<column-name>category_id</column-name>
</key-field>
</key-fields>
</ejb-relationship-role>

<ejb-relationship-role>
<ejb-relationship-role-name>Book-in-Category</ejb-relationship-role-name>
<key-fields>
<key-field>
<field-name>book_id</field-name>
<column-name>book_id</column-name>
</key-field>
</key-fields>
</ejb-relationship-role>

</ejb-relation>


</relationships>



</jbosscmp-jdbc>
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: jbosscmp-jdbc.xml nexus with ejb-jar.xml
 
Similar Threads
deployment exception with compound primary key in jboss3.0 getUniqueChild exception
CMR problem in weblogic
CMR configuration confusion
is it bug in jboss3.0 in cmr need help
Issue in CMR entity bean