[jboss-user] [EJB 3.0] - Persistence in EJB3

masoodah@mdsit.com do-not-reply at jboss.com
Fri Jan 25 12:03:53 EST 2008


Hi,
I am new to EJB3. I am using Persistence to connect to Mysql
I got the following error when I try to deploy

11:32:39,410 INFO  [EJBContainer] STARTED EJB: com.dreamplay.dpds.ejb.LogonTopicBean ejbName: LogonTopicBean
11:32:39,894 INFO  [EJB3Deployer] Deployed: file:/C:/jboss-4.2.0.GA/server/default/deploy/DPDS-Server.jar
11:32:39,894 ERROR [URLDeploymentScanner] Incomplete Deployment listing:

--- MBeans waiting for other MBeans ---
ObjectName: persistence.units:jar=DPDS-Server.jar,unitName=DPDS
  State: NOTYETINSTALLED
  I Depend On:
    jboss.jca:name=MySqlDS,service=DataSourceBinding

--- MBEANS THAT ARE THE ROOT CAUSE OF THE PROBLEM ---
ObjectName: jboss.jca:name=MySqlDS,service=DataSourceBinding
  State: NOTYETINSTALLED
  Depends On Me:
    persistence.units:jar=DPDS-Server.jar,unitName=DPDS


My persistence.xml looks like this
-------------------------------------------
<persistence 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" version="1.0">
 <persistence-unit name="DPDS" transaction-type="JTA">
        org.hibernate.ejb.HibernatePersistence 
        <jta-data-source>java:/MySqlDS</jta-data-source>
properties>
property name="hibernate.show_sql" value="false" /> 
  property name="hibernate.format_sql" value="false" /> 
   property name="hibernate.archive.autodetection" value="class" /> 
   property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver" /> 
   property name="hibernate.connection.url" value="jdbc:mysql://localhost:3306/dreamPlay" /> 
  property name="hibernate.connection.username" value="dreamplay" /> 
  property name="hibernate.connection.password" value="dreamplay" /> 
   property name="hibernate.c3p0.min_size" value="5" /> 
   property name="hibernate.c3p0.max_size" value="20" /> 
   property name="hibernate.c3p0.timeout" value="3000" /> 
   property name="hibernate.c3p0.max_statements" value="50" /> 
   property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect" /> 
    property name="hibernate.hbm2ddl.auto" value="create-drop" /> 
     property name="hibernate.transaction.factory.class" value="org.hibernate.transaction.JTATransactionFactory"/>		            
   property name="transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup"/>	
    property name="cache.provider_class" value="org.hibernate.cache.HashtableCacheProvider"/>
   properties>
  -------------------------------------------
And my method call is

EntityManagerFactory entityMangerFactory = Persistence.createEntityManagerFactory("DPDS");                    EntityManager entityManager =
                entityMangerFactory.createEntityManager();                    EntityTransaction entityTransaction = null;
                    
                    try{
                        entityTransaction = entityManager.getTransaction();
                         entityTransaction.begin();
                          UserDAO userDao = new UserDAO();
                        userDao.setUserId(userObj.getUserId());
                        userDao.setPassword(userObj.getPassword());
                        userDao.setLogonTime(userObj.getLogonTime());
                          
                        entityManager.persist(userDao);
                        entityTransaction.commit();
                                                        
                    } catch( Exception exc ){
                        if ( entityTransaction != null ){
                            entityTransaction.rollback();
                        }
                    } finally {
                        entityManager.close();
                        entityMangerFactory.close();
                    }

Please help me. What I am doing wrong.
Thanks
ma1


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4123591#4123591

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4123591



More information about the jboss-user mailing list