0 Replies Latest reply on Jul 26, 2005 7:52 AM by Sameer Saptarishi

    Deploying entity bean on JBoss 4.0.2

    Sameer Saptarishi Newbie

      Hi All,
      I am trying to deploy a CMP bean on Jboss 4.0.2 with MySQLDB as my backened.

      Can anyone tell me what are the configuration files required.
      The ones which I have used are as follows

      1) ejb-jar.xml
      2) jbosscmp-jdbc.xml
      3) mysql-ds.xml
      4) jboss.xml.


      My beans are deployed correctly and the tables are created on the backened.
      But records do not get entered in to these tables.
      Can anyone tell me what I am missing.

      Here is my ejb-jar.xml
      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
      <ejb-jar>
      <enterprise-beans>

      <ejb-name>UserManager</ejb-name>
      com.cygnet.medina.UserManager.UserManagerHome
      com.cygnet.medina.UserManager.UserManager
      <ejb-class>com.cygnet.medina.UserManager.UserManagerEJB</ejb-class>
      <session-type>Stateless</session-type>
      <transaction-type>Container</transaction-type>


      <assembly-descriptor>
      <container-transaction>

      <ejb-name>UserManager</ejb-name>
      <method-name>*</method-name>

      <trans-attribute>Required</trans-attribute>
      </container-transaction>
      </assembly-descriptor>



      <ejb-name>HospitalManager</ejb-name>
      com.cygnet.medina.HospitalManager.HospitalManagerHome
      com.cygnet.medina.HospitalManager.HospitalManager
      <ejb-class>com.cygnet.medina.HospitalManager.HospitalManagerEJB</ejb-class>
      <session-type>Stateless</session-type>
      <transaction-type>Container</transaction-type>


      <assembly-descriptor>
      <container-transaction>

      <ejb-name>HospitalManager</ejb-name>
      <method-name>*</method-name>

      <trans-attribute>Required</trans-attribute>
      </container-transaction>
      </assembly-descriptor>


      <ejb-name>AnesthesiaUser</ejb-name>
      com.cygnet.medina.user.AnesthesiaUserHome
      com.cygnet.medina.user.AnesthesiaUser
      <ejb-class>com.cygnet.medina.user.AnesthesiaUserEJB</ejb-class>
      <persistence-type>Container</persistence-type>
      <prim-key-class>java.lang.Long</prim-key-class>
      False
      <cmp-version>2.x</cmp-version>
      <abstract-schema-name>AnesthesiaUser</abstract-schema-name>
      <cmp-field>
      <field-name>userid</field-name>
      <column-name>userid</column-name>
      </cmp-field>
      <cmp-field>
      <field-name>username</field-name>
      <column-name>username</column-name>
      </cmp-field>
      <cmp-field>
      <field-name>password</field-name>
      <column-name>password</column-name>
      </cmp-field>
      <cmp-field>
      <field-name>usertype</field-name>
      <column-name>usertype</column-name>
      </cmp-field>
      <cmp-field>
      <field-name>createddate</field-name>
      <column-name>createddate</column-name>
      </cmp-field>
      <cmp-field>
      <field-name>updateddate</field-name>
      <column-name>updateddate</column-name>
      </cmp-field>
      <primkey-field>userid</primkey-field>

      <query-method>
      <method-name>findByUsername</method-name>
      <method-params>
      <method-param>java.lang.String</method-param>
      </method-params>
      </query-method>
      <ejb-ql></ejb-ql>



      <assembly-descriptor>
      <container-transaction>

      <ejb-name>AnesthesiaUser</ejb-name>
      <method-name>*</method-name>

      <trans-attribute>Required</trans-attribute>
      </container-transaction>
      </assembly-descriptor>
      <!-- Added -->


      <ejb-name>Hospital</ejb-name>
      com.cygnet.medina.Hospital.HospitalHome
      com.cygnet.medina.Hospital.Hospital
      <ejb-class>com.cygnet.medina.Hospital.HospitalEJB</ejb-class>
      <persistence-type>Container</persistence-type>
      <prim-key-class>java.lang.Long</prim-key-class>
      False
      <cmp-version>2.x</cmp-version>
      <abstract-schema-name>Hospital</abstract-schema-name>
      <cmp-field>
      <field-name>hospitalid</field-name>
      <column-name>hospitalid</column-name>
      </cmp-field>
      <cmp-field>
      <field-name>hospitalname</field-name>
      <column-name>hospitalname</column-name>
      </cmp-field>
      <primkey-field>hospitalid</primkey-field>

      <assembly-descriptor>
      <container-transaction>

      <ejb-name>Hospital</ejb-name>
      <method-name>*</method-name>

      <trans-attribute>Required</trans-attribute>
      </container-transaction>
      </assembly-descriptor>
      <!-- End -->

      </enterprise-beans>
      </ejb-jar>


      Here is my jbosscmp-jdbc.xml

      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE jbosscmp-jdbc PUBLIC
      "-//JBoss//DTD JBOSSCMP-JDBC 4.0//EN"
      "http://www.jboss.org/j2ee/dtd/jbosscmp-jdbc_4_0.dtd">

      <!-- ===================================================================== -->
      <!-- -->
      <!-- Standard JBossCMP-JDBC Configuration -->
      <!-- -->
      <!-- ===================================================================== -->

      <!-- $Id: standardjbosscmp-jdbc.xml,v 1.84.2.6 2005/01/26 18:51:35 starksm Exp $ -->

      <jbosscmp-jdbc>


      java:/MySqlDS
      <!-- optional since 4.0 <datasource-mapping>Hypersonic SQL</datasource-mapping> -->
      <create-table>true</create-table>
      <remove-table>false</remove-table>
      <read-only>false</read-only>
      <read-time-out>300000</read-time-out>
      <row-locking>false</row-locking>
      <pk-constraint>true</pk-constraint>
      <fk-constraint>false</fk-constraint>


      <enterprise-beans>

      <ejb-name>AnesthesiaUser</ejb-name>
      <pk-constraint>true</pk-constraint>
      <table-name>AnesthesiaUser</table-name>
      <cmp-field>
      <field-name>userid</field-name>
      <column-name>userid</column-name>
      <jdbc-type>BIGINT</jdbc-type>
      <sql-type>BIGINT</sql-type>
      </cmp-field>
      <cmp-field>
      <field-name>username</field-name>
      <column-name>username</column-name>
      <jdbc-type>VARCHAR</jdbc-type>
      <sql-type>VARCHAR(50)</sql-type>
      </cmp-field>
      <cmp-field>
      <field-name>password</field-name>
      <column-name>password</column-name>
      <jdbc-type>VARCHAR</jdbc-type>
      <sql-type>VARCHAR(50)</sql-type>
      </cmp-field>
      <cmp-field>
      <field-name>usertype</field-name>
      <column-name>usertype</column-name>
      <jdbc-type>VARCHAR</jdbc-type>
      <sql-type>VARCHAR(50)</sql-type>
      </cmp-field>
      <cmp-field>
      <field-name>createddate</field-name>
      <column-name>createddate</column-name>
      <jdbc-type>TIMESTAMP</jdbc-type>
      <sql-type>DATETIME</sql-type>
      </cmp-field>
      <cmp-field>
      <field-name>updateddate</field-name>
      <column-name>updateddate</column-name>
      <jdbc-type>TIMESTAMP</jdbc-type>
      <sql-type>DATETIME</sql-type>
      </cmp-field>

      <query-method>
      <method-name>findByUsername</method-name>
      <method-params>
      <method-param>java.lang.String</method-param>
      </method-params>
      </query-method>
      <jboss-ql><![CDATA[
      SELECT OBJECT(u)
      FROM AnesthesiaUser u
      WHERE u.username = ?1 ]]></jboss-ql>

      <unknown-pk>
      <unknown-pk-class>java.lang.Long</unknown-pk-class>
      <column-name>userid</column-name>
      <jdbc-type>BIGINT</jdbc-type>
      <sql-type>BIGINT</sql-type>
      <auto-increment/>
      </unknown-pk>

      <entity-command name="mysql-get-generated-keys"/>




      <!-- Added -->

      <ejb-name>Hospital</ejb-name>
      <pk-constraint>true</pk-constraint>
      <table-name>Hospital</table-name>
      <cmp-field>
      <field-name>hospitalid</field-name>
      <column-name>hospitalid</column-name>
      <jdbc-type>BIGINT</jdbc-type>
      <sql-type>BIGINT</sql-type>
      </cmp-field>
      <cmp-field>
      <field-name>hospitalname</field-name>
      <column-name>hospitalname</column-name>
      <jdbc-type>VARCHAR</jdbc-type>
      <sql-type>VARCHAR(50)</sql-type>
      </cmp-field>
      <unknown-pk>
      <unknown-pk-class>java.lang.Long</unknown-pk-class>
      <column-name>hospitalid</column-name>
      <jdbc-type>BIGINT</jdbc-type>
      <sql-type>BIGINT</sql-type>
      <auto-increment/>
      </unknown-pk>
      <entity-command name="mysql-get-generated-keys"/>


      <!-- End -->
      </enterprise-beans>

      </jbosscmp-jdbc>


      Please tell me what I am missing in this configuration.

      Thanks in advance to all of you out there.
      Regards
      P2