Uploaded image for project: 'OpenJPA'
  1. OpenJPA
  2. OPENJPA-1675

CreateQuery doesn't work when we don't define the classes in Persistance.xml in case of CMT(Container Managed Transaction)

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Cannot Reproduce
    • None
    • None
    • None
    • I have weblogic system libraries having javax.persistence_1.0.0.0_1-0.jar and org.apache.openjpa_2.2.0.0_1-1-0.jar.

    Description

      The entity classes need not be defined in persistance.xml, in case when the Container is handling the Entity and their transaction. I don't get issue when use find method of EntityManager. I get issue when using the CreateQuery method. could you please tell me why this is happening.

      1. <persistence-unit name="eclepJTA">
      <jta-data-source>eclep.jpa.DataSource</jta-data-source>
      <class>org.wadsworth.check.dto.FacDto</class>
      </persistence-unit>

      2. Base entity Class

      @MappedSuperclass
      public abstract class BaseFacDto implements Serializable{
      – all variables —
      }

      3. Entity Class

      @Entity
      @Table(name="E_FAC")
      public class FacDto extends BaseFacDto implements Serializable {
      -----All variables ----
      }

      4. CreateQuery methods throws an error saying FacDTO is not recognied
      List<FacDto> results = em.createQuery("SELECT f FROM FacDto f where f.facId IN ( '0240','2222','2343','4444') ").getResultList();

      5. Find method works fine:
      FacDto fac = em.find(FacDto.class, '0240')

      Attachments

        Activity

          People

            curtisr7 Richard G. Curtis
            veeraj21@gmail.com Rajeev Chaudhary
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 20h
                20h
                Remaining:
                Remaining Estimate - 20h
                20h
                Logged:
                Time Spent - Not Specified
                Not Specified