2 Replies Latest reply on Feb 17, 2011 2:16 AM by meenarajani

    Bean managed or Container managed entities use third party ORM tools???

    meenarajani

      Hi

       

       

      While I am reading stuff on EJB3.0 it says JPA is an specification not implementation(while some times I find stuff which says it actually provides librarry for ORM and we can do the same task of ORM mapping done with Hibernate). Most of the time I see toplink or hibernate being used in persistence.xml file.

       

      I am using JBOSS application server 6.

       

      1-The question is can we use container managed persistence CMP or bean managed persistence  BMP entities without third part ORM tools to persist data to a relational DBMS???

      2-If the answer to above question is yes in case of CMP, then why it is necessary for BMP to use third party ORM tools?

      3- Can you send a link to any example code which does not use any third party ORM tool is not used.

       

       

      Thanks

       

      Meena

        • 1. Bean managed or Container managed entities use third party ORM tools???
          wdfink

          Hi,

          as far as I understand you mix EJB2 and EJB3 specification.

          1+2)

          CMP or BMP Container/Bean Managed Persistence is part of EJB2 spec.

           

          With EJB3 you will have simple Java classes with JPA annotations. The application server or even the JVM supports that you bind a persistence manager like Hibernate or Toplink to persist the data to a database.

          You might use specific annotations of toplink or hibernate to have more control about the the persistence manager but it is not necessary from the beginning.

           

          3)

          http://http://www.oracle.com/technetwork/java/javaee/tech/persistence-jsp-140049.html Oracle

          or the specification itself

          http://jcp.org/aboutJava/communityprocess/final/jsr220/index.html

          might be a good starting point.

          Also you will find help within the JBoss wiki pages

          • 2. Re: Bean managed or Container managed entities use third party ORM tools???
            meenarajani

            Hi Wolf,

             

            You were right I was imixing EJB2 and EJB3.

            As you have mentioned annotation is not necessary to have control of persistence manager. I have a question is it necessary to use third party ORM tool, like Toplink or Hibernate for EJB3?  Does this implementation of ORM is provided by JBOSS container or JPA 2.0 ?

             

            for example I have following persistence.xml file, if I am commenting the provider " <provider>org.hibernate.ejb.HibernatePersistence</provider> " I  am not seeing any  tables being created in Database. When I uncomment the provider and properties, my application is creating table and inserting data.

             

            If container by default provides it I mean if it is possible then  what do we substitute for provider or any other configuration which let me use container' s own persistence management.

             

             

             

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

            <persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">

               <persistence-unit name="BookAuthorApp3-ejbPU" transaction-type="JTA">

             

            <!--   <provider>org.hibernate.ejb.HibernatePersistence</provider>   -->

             

                     <jta-data-source>java:/PostgresDS</jta-data-source>

                     <exclude-unlisted-classes>false</exclude-unlisted-classes>

             

              <!--    <properties>

                   <property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect" />

                          <property name="hibernate.hbm2ddl.auto" value="update"/> 

                  </properties> -->

             

               </persistence-unit>

            </persistence>

             

             

            Thanks

             

            Meena