Uploaded image for project: 'OpenEJB'
  1. OpenEJB
  2. OPENEJB-2097

EJB 2.1 CMB Entity Beans support on Tomme



    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • cmp2
    • None


      We are migrating our EJB applications from weblogic 10.3.5 to Tomme 1.6. We followed the sample provided in the below link for migrating out EJB 2.1 CMP Entity Beans:

      We are able to create CMP Entity Beans on Tomee using the sample available on the above link after making some modifications.
      The sample is intended for having CMP Entity Bean in the name of the table. For e.g. If my CMP Entity Bean name is MovieBean, then I need to have a table in the database only in the name MovieBean.
      When I try to point to a different table called Movie by having a mapping file (my-orm.xml) and configuration for that mapping file in the persistence.xml, I’m getting the following warning message:
      openjpa.MetaData - Found duplicate metadata or mapping for "class XXX.XXX1". Ignoring.

      The configuration are being picked from ejb-jar.xml, not from the mapping file.
      The content of persistence.xml and my-orm.xml are given below:


      <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
      <persistence xmlns="http://java.sun.com/xml/ns/persistence" version="1.0">
      <persistence-unit name="cmp" transaction-type="JTA">
      <property name="openjpa.jdbc.SynchronizeMappings"
      value="buildSchema(ForeignKeys=true, Indexes=false, IgnoreErrors=true)"/>
      <!-- We have tried with the below validate value for mapping openjpa.jdbc.SynchronizeMappings -->
      <!--<property name="openjpa.jdbc.SynchronizeMappings"
      value="validate"/> -->
      <property name="openjpa.Log" value="DefaultLevel=INFO"/>



      <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
      <entity-mappings xmlns="http://java.sun.com/xml/ns/persistence/orm" version="1.0">
      <entity class="openejb.com.tcm.cmp.MovieBean" name="MovieBean">
      <table name="Movie_Bean"/>
      <named-query name="MovieBean.findByDirector(java.lang.String)">
      <query>SELECT m FROM MovieBean m WHERE m.director = ?1</query>
      <named-query name="MovieBean.findAll">
      <query>SELECT m FROM MovieBean as m</query>
      <id name="id">
      <column name="id"/>
      <generated-value strategy="IDENTITY"/>

      <basic name="director" >
      <column name="director"/>

      <basic name="year">
      <column name="year"/>

      <basic name="title">
      <column name="title"/>


      <ejb-ql>SELECT m FROM MovieBean m WHERE m.director = ?1</ejb-ql>
      <ejb-ql>SELECT m FROM MovieBean as m</ejb-ql>

      If I don’t give the <query> in ejb.jar.xml, I’m getting the error saying “No Query defined for MovieBean.findAll"

      Could be please share your findings on EJB 2.1 CMB Entity bean support for Tomee? Is it possible to provide custom table names for EJB 2.1 CMB Entity bean using mapping file?




            Unassigned Unassigned
            rajbabu Rajbabu
            0 Vote for this issue
            1 Start watching this issue