0 Replies Latest reply on Aug 30, 2006 3:13 AM by Primitivo Dimahugot

    retrieving row in a one-to-many relationship

    Primitivo Dimahugot Newbie

      Good Day To All,
      i am new to jboss cmp 2.x.
      my problem now is this:
      i want to retrieve rows from a transaction table in a one-to-many relationship using 3 parameters. For example,using SQL, "SELECT * FROM tTrnTimeInOut where EmployeeId='010' and InOutDate Between 08/01/2006' and '08/31/2006'"

      What i am getting right now is all records from tTrnInOut table with EmployeeId only as the criteria. Am working on a web application, EmployeeeId being the username. I want to have greater flexibility in selecting records using more than 1 criteria.

      Notice that i dont have a select or finder method for this in my ejb-jar.xml file because I dont know where and how to do it.

      The web page displays records from tTrnInOut table but i think the container did it for me, as can be seen from the console window of jboss server.

      Please help me on how to create ejb ql for the above situation.

      Thank You and More Power.



      This is the structure of my tables:

      tMasEmployee
      EmployeeId (PK)
      FName
      LName


      tTrnInOut
      InOutID (PK)
      EmployeeId (FK)
      InOutDate
      TimeIn
      TimeOut

      Note: i did not include all fields for brevity.

      ejb-jar file:
      <?xml version="1.0" encoding="UTF-8"?>
      <ejb-jar 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>myHRO</display-name>
      <enterprise-beans>

      <display-name>DataAccessBean</display-name>
      <ejb-name>DataAccessBean</ejb-name>
      <local-home>com.chiyoda.myhro.dp.sf.DataAccessLocalHome</local-home>
      com.chiyoda.myhro.dp.sf.DataAccessLocalObject
      <ejb-class>com.chiyoda.myhro.dp.sf.DataAccessSessionBean</ejb-class>
      <session-type>Stateless</session-type>
      <transaction-type>Container</transaction-type>

      <ejb-local-ref>
      <ejb-ref-name>ejb/DataAccessRef</ejb-ref-name>
      <ejb-ref-type>Entity</ejb-ref-type>
      <local-home>com.chiyoda.myhro.dp.sf.DataAccessLocalHome</local-home>
      com.chiyoda.myhro.dp.sf.DataAccessLocalObject
      <ejb-link>DataAccessBean</ejb-link>
      </ejb-local-ref>



      <display-name>EmployeeBean</display-name>
      <ejb-name>EmployeeBean</ejb-name>
      <local-home>com.chiyoda.myhro.entity.employee.work.EmployeeLocalHome</local-home>
      com.chiyoda.myhro.entity.employee.work.EmployeeLocalObject
      <ejb-class>com.chiyoda.myhro.entity.employee.work.EmployeeBean</ejb-class>
      <persistence-type>Container</persistence-type>
      <prim-key-class>java.lang.String</prim-key-class>
      false
      <cmp-version>2.x</cmp-version>
      <abstract-schema-name>tMasEmployee</abstract-schema-name>

      <cmp-field>
      <field-name>EmployeeId</field-name>
      </cmp-field>

      <cmp-field>
      <field-name>UserPass</field-name>
      </cmp-field>

      <cmp-field>
      <field-name>FName</field-name>
      </cmp-field>

      <cmp-field>
      <field-name>MName</field-name>
      </cmp-field>

      <cmp-field>
      <field-name>LName</field-name>
      </cmp-field>

      <cmp-field>
      <field-name>PositionID</field-name>
      </cmp-field>

      <cmp-field>
      <field-name>DepartmentID</field-name>
      </cmp-field>

      <primkey-field>EmployeeId</primkey-field>

      <ejb-local-ref>
      <ejb-ref-name>ejb/EmployeeRef</ejb-ref-name>
      <ejb-ref-type>Entity</ejb-ref-type>
      <local-home>com.chiyoda.myhro.entity.employee.work.EmployeeLocalHome</local-home>
      com.chiyoda.myhro.entity.employee.work.EmployeeLocalObject
      <ejb-link>EmployeeBean</ejb-link>
      </ejb-local-ref>

      <security-identity>

      <use-caller-identity></use-caller-identity>
      </security-identity>



      <query-method>
      <method-name>findUserLogin</method-name>
      <method-params>
      <method-param>java.lang.String</method-param>
      <method-param>java.lang.String</method-param>
      </method-params>
      </query-method>
      <ejb-ql>select object(e) from tMasEmployee e
      where e.EmployeeId = ?1 and e.UserPass = ?2</ejb-ql>




      <display-name>PositionBean</display-name>
      <ejb-name>PositionBean</ejb-name>
      <local-home>com.chiyoda.myhro.entity.basetable.position.PositionLocalHome</local-home>
      com.chiyoda.myhro.entity.basetable.position.PositionLocalObject
      <ejb-class>com.chiyoda.myhro.entity.basetable.position.PositionBean</ejb-class>
      <persistence-type>Container</persistence-type>
      <prim-key-class>java.lang.String</prim-key-class>
      false
      <cmp-version>2.x</cmp-version>
      <abstract-schema-name>tMasPosition</abstract-schema-name>

      <cmp-field>
      <field-name>PositionID</field-name>
      </cmp-field>

      <cmp-field>
      <field-name>PositionName</field-name>
      </cmp-field>

      <cmp-field>
      <field-name>PositionAlias</field-name>
      </cmp-field>

      <primkey-field>PositionID</primkey-field>

      <ejb-local-ref>
      <ejb-ref-name>ejb/PositionRef</ejb-ref-name>
      <ejb-ref-type>Entity</ejb-ref-type>
      <local-home>com.chiyoda.myhro.entity.basetable.position.PositionLocalHome</local-home>
      com.chiyoda.myhro.entity.basetable.position.PositionLocalObject
      <ejb-link>PositionBean</ejb-link>
      </ejb-local-ref>

      <security-identity>

      <use-caller-identity></use-caller-identity>
      </security-identity>



      <display-name>DepartmentBean</display-name>
      <ejb-name>DepartmentBean</ejb-name>
      <local-home>com.chiyoda.myhro.entity.basetable.department.DepartmentLocalHome</local-home>
      com.chiyoda.myhro.entity.basetable.department.DepartmentLocalObject
      <ejb-class>com.chiyoda.myhro.entity.basetable.department.DepartmentBean</ejb-class>
      <persistence-type>Container</persistence-type>
      <prim-key-class>java.lang.String</prim-key-class>
      false
      <cmp-version>2.x</cmp-version>
      <abstract-schema-name>tMasDepartment</abstract-schema-name>

      <cmp-field>
      <field-name>DepartmentID</field-name>
      </cmp-field>

      <cmp-field>
      <field-name>DepartmentName</field-name>
      </cmp-field>

      <cmp-field>
      <field-name>DepartmentAlias</field-name>
      </cmp-field>

      <primkey-field>DepartmentID</primkey-field>

      <ejb-local-ref>
      <ejb-ref-name>ejb/DepartmentRef</ejb-ref-name>
      <ejb-ref-type>Entity</ejb-ref-type>
      <local-home>com.chiyoda.myhro.entity.basetable.department.DepartmentLocalHome</local-home>
      com.chiyoda.myhro.entity.basetable.department.DepartmentLocalObject
      <ejb-link>DepartmentBean</ejb-link>
      </ejb-local-ref>

      <security-identity>

      <use-caller-identity></use-caller-identity>
      </security-identity>



      <display-name>TimeInOutBean</display-name>
      <ejb-name>TimeInOutBean</ejb-name>
      <local-home>com.chiyoda.myhro.entity.timetrans.TimeInOutLocalHome</local-home>
      com.chiyoda.myhro.entity.timetrans.TimeInOutLocalObject
      <ejb-class>com.chiyoda.myhro.entity.timetrans.TimeInOutBean</ejb-class>
      <persistence-type>Container</persistence-type>
      <prim-key-class>java.lang.String</prim-key-class>
      false
      <cmp-version>2.x</cmp-version>
      <abstract-schema-name>tTrnInOut</abstract-schema-name>

      <cmp-field>
      <field-name>InOutID</field-name>
      </cmp-field>

      <cmp-field>
      <field-name>EmployeeId</field-name>
      </cmp-field>

      <cmp-field>
      <field-name>CutOffSchedID</field-name>
      </cmp-field>

      <cmp-field>
      <field-name>InOutDate</field-name>
      </cmp-field>

      <cmp-field>
      <field-name>TimeIn</field-name>
      </cmp-field>

      <cmp-field>
      <field-name>TimeOut</field-name>
      </cmp-field>

      <cmp-field>
      <field-name>TimeSource</field-name>
      </cmp-field>

      <cmp-field>
      <field-name>TimeRemarks</field-name>
      </cmp-field>

      <cmp-field>
      <field-name>InOut</field-name>
      </cmp-field>

      <cmp-field>
      <field-name>InOutX</field-name>
      </cmp-field>

      <primkey-field>InOutID</primkey-field>

      <ejb-local-ref>
      <ejb-ref-name>ejb/TimeInOutRef</ejb-ref-name>
      <ejb-ref-type>Entity</ejb-ref-type>
      <local-home>com.chiyoda.myhro.entity.timetrans.TimeInOutLocalHome</local-home>
      com.chiyoda.myhro.entity.timetrans.TimeInOutLocalObject
      <ejb-link>TimeInOutBean</ejb-link>
      </ejb-local-ref>

      <security-identity>

      <use-caller-identity></use-caller-identity>
      </security-identity>

      </enterprise-beans>


      <ejb-relation>
      <ejb-relationship-role>
      <ejb-relationship-role-name>EmployeeBean-PositionBean-WorkInfo</ejb-relationship-role-name>
      One
      <relationship-role-source>
      <ejb-name>EmployeeBean</ejb-name>
      </relationship-role-source>

      <cmr-field>
      <cmr-field-name>PositionID</cmr-field-name>
      </cmr-field>
      </ejb-relationship-role>

      <ejb-relationship-role>
      <ejb-relationship-role-name>PositionBean-EmployeeBean-WorkInfo</ejb-relationship-role-name>
      One
      <cascade-delete />
      <relationship-role-source>
      <ejb-name>PositionBean</ejb-name>
      </relationship-role-source>
      </ejb-relationship-role>
      </ejb-relation>

      <ejb-relation>
      <ejb-relationship-role>
      <ejb-relationship-role-name>EmployeeBean-DepartmentBean</ejb-relationship-role-name>
      One
      <relationship-role-source>
      <ejb-name>EmployeeBean</ejb-name>
      </relationship-role-source>

      <cmr-field>
      <cmr-field-name>DepartmentID</cmr-field-name>
      </cmr-field>
      </ejb-relationship-role>

      <ejb-relationship-role>
      <ejb-relationship-role-name>DepartmentBean-EmployeeBean</ejb-relationship-role-name>
      One
      <cascade-delete />
      <relationship-role-source>
      <ejb-name>DepartmentBean</ejb-name>
      </relationship-role-source>
      </ejb-relationship-role>
      </ejb-relation>

      <ejb-relation>
      <ejb-relation-name>EmployeeBean-TimeInOutBean</ejb-relation-name>
      <ejb-relationship-role>
      <ejb-relationship-role-name>emp-has-inOutTrans</ejb-relationship-role-name>
      One
      <relationship-role-source>
      <ejb-name>EmployeeBean</ejb-name>
      </relationship-role-source>

      <cmr-field>
      <cmr-field-name>inOutTrans</cmr-field-name>
      <cmr-field-type>java.util.Collection</cmr-field-type>
      </cmr-field>
      </ejb-relationship-role>

      <ejb-relationship-role>
      <ejb-relationship-role-name>inout-belongs-to-emp</ejb-relationship-role-name>
      Many
      <cascade-delete/>

      <relationship-role-source>
      <ejb-name>TimeInOutBean</ejb-name>
      </relationship-role-source>

      <cmr-field>
      <cmr-field-name>employee</cmr-field-name>
      </cmr-field>
      </ejb-relationship-role>
      </ejb-relation>


      <assembly-descriptor>
      <container-transaction>

      <ejb-name>EmployeeBean</ejb-name>
      <method-intf>LocalHome</method-intf>
      <method-name>create</method-name>
      <method-params>
      <method-param>java.lang.String</method-param>
      <method-param>java.lang.String</method-param>
      </method-params>

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

      <container-transaction>

      <ejb-name>EmployeeBean</ejb-name>
      <method-intf>Local</method-intf>
      <method-name>getEmployeeId</method-name>

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

      <container-transaction>

      <ejb-name>EmployeeBean</ejb-name>
      <method-intf>Local</method-intf>
      <method-name>getUserPass</method-name>

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

      <container-transaction>

      <ejb-name>EmployeeBean</ejb-name>
      <method-intf>Local</method-intf>
      <method-name>getFName</method-name>

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

      <container-transaction>

      <ejb-name>EmployeeBean</ejb-name>
      <method-intf>Local</method-intf>
      <method-name>getMName</method-name>

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

      <container-transaction>

      <ejb-name>EmployeeBean</ejb-name>
      <method-intf>Local</method-intf>
      <method-name>getLName</method-name>

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

      <container-transaction>

      <ejb-name>EmployeeBean</ejb-name>
      <method-intf>Local</method-intf>
      <method-name>getPositionID</method-name>

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

      <container-transaction>

      <ejb-name>EmployeeBean</ejb-name>
      <method-intf>Local</method-intf>
      <method-name>getDepartmentID</method-name>

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

      <container-transaction>

      <ejb-name>PositionBean</ejb-name>
      <method-intf>Local</method-intf>
      <method-name>getPositionID</method-name>

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

      <container-transaction>

      <ejb-name>PositionBean</ejb-name>
      <method-intf>Local</method-intf>
      <method-name>getPositionName</method-name>

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

      <container-transaction>

      <ejb-name>PositionBean</ejb-name>
      <method-intf>Local</method-intf>
      <method-name>getPositionAlias</method-name>

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

      <container-transaction>

      <ejb-name>DepartmentBean</ejb-name>
      <method-intf>Local</method-intf>
      <method-name>getDepartmentID</method-name>

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

      <container-transaction>

      <ejb-name>DepartmentBean</ejb-name>
      <method-intf>Local</method-intf>
      <method-name>getDepartmentName</method-name>

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

      <container-transaction>

      <ejb-name>DepartmentBean</ejb-name>
      <method-intf>Local</method-intf>
      <method-name>getDepartmentAlias</method-name>

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

      <container-transaction>

      <ejb-name>TimeInOutBean</ejb-name>
      <method-intf>Local</method-intf>
      <method-name>getInOutID</method-name>

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

      <container-transaction>

      <ejb-name>TimeInOutBean</ejb-name>
      <method-intf>Local</method-intf>
      <method-name>getEmployeeId</method-name>

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

      <container-transaction>

      <ejb-name>TimeInOutBean</ejb-name>
      <method-intf>Local</method-intf>
      <method-name>getCutOffSchedID</method-name>

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

      <container-transaction>

      <ejb-name>TimeInOutBean</ejb-name>
      <method-intf>Local</method-intf>
      <method-name>getInOutDate</method-name>

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

      <container-transaction>

      <ejb-name>TimeInOutBean</ejb-name>
      <method-intf>Local</method-intf>
      <method-name>getTimeIn</method-name>

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

      <container-transaction>

      <ejb-name>TimeInOutBean</ejb-name>
      <method-intf>Local</method-intf>
      <method-name>getTimeOut</method-name>

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

      <container-transaction>

      <ejb-name>TimeInOutBean</ejb-name>
      <method-intf>Local</method-intf>
      <method-name>getTimeSource</method-name>

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

      <container-transaction>

      <ejb-name>TimeInOutBean</ejb-name>
      <method-intf>Local</method-intf>
      <method-name>getTimeRemarks</method-name>

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

      <container-transaction>

      <ejb-name>TimeInOutBean</ejb-name>
      <method-intf>Local</method-intf>
      <method-name>getInOut</method-name>

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

      <container-transaction>

      <ejb-name>TimeInOutBean</ejb-name>
      <method-intf>Local</method-intf>
      <method-name>getInOutX</method-name>

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

      <container-transaction>

      <ejb-name>TimeInOutBean</ejb-name>
      <method-intf>Local</method-intf>
      <method-name>getTeams</method-name>
      <method-params />

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

      jbosscmp-jdbc.xml
      <?xml version="1.0" encoding="UTF-8"?>

      <!DOCTYPE jbosscmp-jdbc PUBLIC
      "-//JBoss//DTD JBOSSCMP-JDBC 3.0//EN"
      "http://www.jboss.org/j2ee/dtd/jbosscmp-jdbc_3_0.dtd">

      <jbosscmp-jdbc>

      java:/myhro
      <datasource-mapping>Hypersonic SQL</datasource-mapping>
      <create-table>true</create-table>
      <remove-table>false</remove-table>
      <pk-constraint>true</pk-constraint>
      <preferred-relation-mapping>foreign-key</preferred-relation-mapping>


      <enterprise-beans>

      <ejb-name>EmployeeBean</ejb-name>
      <table-name>tMasEmployee</table-name>

      <cmp-field>
      <field-name>EmployeeId</field-name>
      <column-name>EmployeeId</column-name>
      <jdbc-type>VARCHAR</jdbc-type>
      <sql-type>VARCHAR(15)</sql-type>
      </cmp-field>

      <cmp-field>
      <field-name>UserPass</field-name>
      <column-name>UserPass</column-name>
      <jdbc-type>VARCHAR</jdbc-type>
      <sql-type>VARCHAR(15)</sql-type>
      </cmp-field>

      <cmp-field>
      <field-name>FName</field-name>
      <column-name>FName</column-name>
      <jdbc-type>VARCHAR</jdbc-type>
      <sql-type>VARCHAR(255)</sql-type>
      </cmp-field>

      <cmp-field>
      <field-name>MName</field-name>
      <column-name>MName</column-name>
      <jdbc-type>VARCHAR</jdbc-type>
      <sql-type>VARCHAR(255)</sql-type>
      </cmp-field>

      <cmp-field>
      <field-name>LName</field-name>
      <column-name>LName</column-name>
      <jdbc-type>VARCHAR</jdbc-type>
      <sql-type>VARCHAR(255)</sql-type>
      </cmp-field>

      <cmp-field>
      <field-name>PositionID</field-name>
      <column-name>PositionID</column-name>
      <jdbc-type>VARCHAR</jdbc-type>
      <sql-type>VARCHAR(5)</sql-type>
      </cmp-field>



      <ejb-name>PositionBean</ejb-name>
      <table-name>tMasPosition</table-name>

      <cmp-field>
      <field-name>PositionID</field-name>
      <column-name>PositionID</column-name>
      <jdbc-type>VARCHAR</jdbc-type>
      <sql-type>VARCHAR(5)</sql-type>
      </cmp-field>

      <cmp-field>
      <field-name>PositionName</field-name>
      <column-name>PositionName</column-name>
      <jdbc-type>VARCHAR</jdbc-type>
      <sql-type>VARCHAR(60)</sql-type>
      </cmp-field>

      <cmp-field>
      <field-name>PositionAlias</field-name>
      <column-name>PositionAlias</column-name>
      <jdbc-type>VARCHAR</jdbc-type>
      <sql-type>VARCHAR(60)</sql-type>
      </cmp-field>



      <ejb-name>DepartmentBean</ejb-name>
      <table-name>tMasDepartment</table-name>

      <cmp-field>
      <field-name>DepartmentID</field-name>
      <column-name>DepartmentID</column-name>
      <jdbc-type>VARCHAR</jdbc-type>
      <sql-type>VARCHAR(5)</sql-type>
      </cmp-field>

      <cmp-field>
      <field-name>DepartmentName</field-name>
      <column-name>DepartmentName</column-name>
      <jdbc-type>VARCHAR</jdbc-type>
      <sql-type>VARCHAR(60)</sql-type>
      </cmp-field>

      <cmp-field>
      <field-name>DepartmentAlias</field-name>
      <column-name>DepartmentAlias</column-name>
      <jdbc-type>VARCHAR</jdbc-type>
      <sql-type>VARCHAR(60)</sql-type>
      </cmp-field>



      <ejb-name>TimeInOutBean</ejb-name>
      <table-name>tTrnInOut</table-name>

      <cmp-field>
      <field-name>InOutID</field-name>
      <column-name>InOutID</column-name>
      <jdbc-type>VARCHAR</jdbc-type>
      <sql-type>VARCHAR(30)</sql-type>
      </cmp-field>

      <cmp-field>
      <field-name>EmployeeId</field-name>
      <column-name>EmployeeId</column-name>
      <jdbc-type>VARCHAR</jdbc-type>
      <sql-type>VARCHAR(15)</sql-type>
      </cmp-field>

      <cmp-field>
      <field-name>CutOffSchedID</field-name>
      <column-name>CutOffSchedID</column-name>
      <jdbc-type>INTEGER</jdbc-type>
      <sql-type>INTEGER</sql-type>
      </cmp-field>

      <cmp-field>
      <field-name>InOutDate</field-name>
      <column-name>InOutDate</column-name>
      <jdbc-type>DATE</jdbc-type>
      <sql-type>DATE</sql-type>
      </cmp-field>

      <cmp-field>
      <field-name>TimeIn</field-name>
      <column-name>TimeIn</column-name>
      <jdbc-type>DATE</jdbc-type>
      <sql-type>DATE</sql-type>
      </cmp-field>

      <cmp-field>
      <field-name>TimeOut</field-name>
      <column-name>TimeOut</column-name>
      <jdbc-type>DATE</jdbc-type>
      <sql-type>DATE</sql-type>
      </cmp-field>

      <cmp-field>
      <field-name>TimeSource</field-name>
      <column-name>TimeSource</column-name>
      <jdbc-type>VARCHAR</jdbc-type>
      <sql-type>VARCHAR(15)</sql-type>
      </cmp-field>

      <cmp-field>
      <field-name>TimeRemarks</field-name>
      <column-name>TimeRemarks</column-name>
      <jdbc-type>VARCHAR</jdbc-type>
      <sql-type>VARCHAR(255)</sql-type>
      </cmp-field>

      <cmp-field>
      <field-name>InOut</field-name>
      <column-name>InOut</column-name>
      <jdbc-type>VARCHAR</jdbc-type>
      <sql-type>VARCHAR(255)</sql-type>
      </cmp-field>

      <cmp-field>
      <field-name>InOutX</field-name>
      <column-name>InOutX</column-name>
      <jdbc-type>VARCHAR</jdbc-type>
      <sql-type>VARCHAR(255)</sql-type>
      </cmp-field>

      </enterprise-beans>


      <ejb-relation>
      <ejb-relation-name>EmployeeBean-TimeInOutBean</ejb-relation-name>
      <foreign-key-mapping/>

      <ejb-relationship-role>
      <ejb-relationship-role-name>emp-has-inOutTrans</ejb-relationship-role-name>
      <key-fields>
      <key-field>
      <field-name>EmployeeId</field-name>
      <column-name>EmployeeId</column-name>
      </key-field>
      </key-fields>
      </ejb-relationship-role>

      <ejb-relationship-role>
      <ejb-relationship-role-name>inout-belongs-to-emp</ejb-relationship-role-name>
      <key-fields/>
      </ejb-relationship-role>
      </ejb-relation>

      </jbosscmp-jdbc>

      TimeInOutLocalObject
      package com.chiyoda.myhro.entity.timetrans;

      import com.chiyoda.myhro.entity.employee.work.EmployeeLocalObject;

      import javax.ejb.EJBLocalObject;
      import java.util.*;

      public interface TimeInOutLocalObject extends EJBLocalObject
      {
      public String getInOutID();
      public String getEmployeeId();
      public Integer getCutOffSchedID();
      public Date getInOutDate();
      public Date getTimeIn();
      public Date getTimeOut();
      public String getTimeSource();
      public String getTimeRemarks();
      public String getInOut();
      public String getInOutX();

      public EmployeeLocalObject getEmployee();
      }

      TimeInOutLocalHome
      package com.chiyoda.myhro.entity.timetrans;

      import javax.ejb.EJBLocalHome;
      import javax.ejb.CreateException;
      import javax.ejb.FinderException;
      import java.util.*;

      public interface TimeInOutLocalHome extends EJBLocalHome
      {
      TimeInOutLocalObject create(String inOutID, String employeeId, Integer cutOffSchedID, Date inOutDate, Date timeIn, Date timeOut, String timeSource, String timeRemarks, String inOut, String inOutX) throws CreateException;
      TimeInOutLocalObject findByPrimaryKey(String inOutID) throws FinderException;
      }

      TimeInOutBean
      package com.chiyoda.myhro.entity.timetrans;

      import com.chiyoda.myhro.entity.employee.work.EmployeeLocalObject;

      import javax.ejb.CreateException;
      import javax.ejb.EntityBean;
      import javax.ejb.EntityContext;
      import javax.ejb.FinderException;
      import org.apache.log4j.Category;
      import java.util.*;

      public abstract class TimeInOutBean implements EntityBean
      {
      private EntityContext ctx;
      private Category log = Category.getInstance(getClass());

      //start access methods for persistent fields
      public abstract String getInOutID();
      public abstract void setInOutID(String inOutID);

      public abstract String getEmployeeId();
      public abstract void setEmployeeId(String employeeId);

      public abstract Integer getCutOffSchedID();
      public abstract void setCutOffSchedID(Integer cutOffSchedID);

      public abstract Date getInOutDate();
      public abstract void setInOutDate(Date inOutDate);

      public abstract Date getTimeIn();
      public abstract void setTimeIn(Date timeIn);

      public abstract Date getTimeOut();
      public abstract void setTimeOut(Date timeOut);

      public abstract String getTimeSource();
      public abstract void setTimeSource(String timeSource);

      public abstract String getTimeRemarks();
      public abstract void setTimeRemarks(String timeRemarks);

      public abstract String getInOut();
      public abstract void setInOut(String inOut);

      public abstract String getInOutX();
      public abstract void setInOutX(String inOutX);
      //end access methods for persistent fields

      //start...access methods for relationship fields
      public abstract EmployeeLocalObject getEmployee();
      public abstract void setEmployee(EmployeeLocalObject employee);
      //end...access methods for relationship fields

      //start EntityBean methods
      public String ejbCreate(String inOutID, String employeeId, Integer cutOffSchedID, Date inOutDate, Date timeIn, Date timeOut, String timeSource, String timeRemarks, String inOut, String inOutX) throws CreateException
      {
      return create(inOutID, employeeId, cutOffSchedID, inOutDate, timeIn, timeOut, timeSource, timeRemarks, inOut, inOutX);
      }

      private String create(String inOutID, String employeeId, Integer cutOffSchedID, Date inOutDate, Date timeIn, Date timeOut, String timeSource, String timeRemarks, String inOut, String inOutX) throws CreateException
      {
      log.info("Creating inOutID " + inOutID);
      setInOutID(inOutID);
      return inOutID;
      }

      public void ejbPostCreate(String inOutID, String employeeId, Integer cutOffSchedID, Date inOutDate, Date timeIn, Date timeOut, String timeSource, String timeRemarks, String inOut, String inOutX)
      {
      }

      public void setEntityContext(EntityContext context)
      {
      ctx = context;
      }

      public void unsetEntityContext()
      {
      ctx = null;
      }

      public void ejbActivate()
      {
      }

      public void ejbPassivate()
      {
      }

      public void ejbRemove()
      {
      }

      public void ejbStore()
      {
      }

      public void ejbLoad()
      {
      }
      }


      EmployeeLocalObject
      package com.chiyoda.myhro.entity.employee.work;

      import javax.ejb.EJBLocalObject;
      import java.util.ArrayList;
      import java.util.Collection;
      import java.util.Date;

      public interface EmployeeLocalObject extends EJBLocalObject
      {
      public String getEmployeeId();
      public String getUserPass();
      public String getFName();
      public String getMName();
      public String getLName();
      public String getPositionID();
      public String getDepartmentID();

      public Collection getInOutTrans();
      }

      EmployeeLocalHome
      package com.chiyoda.myhro.entity.employee.work;

      import javax.ejb.CreateException;
      import javax.ejb.EJBLocalHome;
      import javax.ejb.FinderException;

      public interface EmployeeLocalHome extends EJBLocalHome
      {
      EmployeeLocalObject create(String employeeId, String userPass, String fName, String mName, String lName, String positionID, String positionName) throws CreateException;
      EmployeeLocalObject findByPrimaryKey(String employeeId) throws FinderException;
      EmployeeLocalObject findUserLogin(String employeeId, String userPass) throws FinderException;
      }

      EmployeeBean

      package com.chiyoda.myhro.entity.employee.work;

      import com.chiyoda.myhro.entity.basetable.position.PositionLocalObject;
      import com.chiyoda.myhro.entity.basetable.department.DepartmentLocalObject;

      import java.util.Collection;
      import java.util.Iterator;
      import java.util.ArrayList;
      import java.util.Set;
      import javax.ejb.*;
      import java.util.Date;

      import org.apache.log4j.Category;

      public abstract class EmployeeBean implements EntityBean
      {
      private EntityContext ctx;
      private Category log = Category.getInstance(getClass());

      //start access methods for persistent fields
      public abstract String getEmployeeId();
      public abstract void setEmployeeId(String employeeId);

      public abstract String getUserPass();
      public abstract void setUserPass(String userPass);

      public abstract String getFName();
      public abstract void setFName(String fName);

      public abstract String getMName();
      public abstract void setMName(String mName);

      public abstract String getLName();
      public abstract void setLName(String lName);

      public abstract String getPositionID();
      public abstract void setPositionID(String positionID);

      public abstract String getDepartmentID();
      public abstract void setDepartmentID(String departmentID);
      //end access methods for persistent fields

      //start access methods for persistent relationship
      //tMasPosition
      public abstract PositionLocalObject getPositionName();
      public abstract void setPositionName(PositionLocalObject positionName);

      //tMasDepartment
      public abstract DepartmentLocalObject getDepartmentName();
      public abstract void setDepartmentName(DepartmentLocalObject departmentName);

      public abstract Collection getInOutTrans();
      public abstract void setInOutTrans(Collection inOutTrans);
      //end access methods for persistent relationship

      //start EntityBean methods
      public String ejbCreate(String employeeId, String userPass, String fName, String mName, String lName, String positionName, String departmentName) throws CreateException
      {
      return create(employeeId, userPass, fName, mName, lName, positionName, departmentName);
      }

      private String create(String employeeId, String userPass, String fName, String mName, String lName, String positionName, String departmentName) throws CreateException
      {
      log.info("Creating Employee ID " + employeeId);
      setEmployeeId(employeeId);
      return employeeId;
      }

      public void ejbPostCreate(String employeeId, String userPass, String fName, String mName, String lName, String positionName, String departmentName)
      {
      }

      public void setEntityContext(EntityContext context)
      {
      ctx = context;
      }

      public void unsetEntityContext()
      {
      ctx = null;
      }

      public void ejbActivate()
      {
      }

      public void ejbPassivate()
      {
      }

      public void ejbRemove()
      {
      }

      public void ejbStore()
      {
      }

      public void ejbLoad()
      {
      }
      }