-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: problem with EJB/CMT in OC4j
PostPosted: Thu Mar 27, 2008 4:20 pm 
Newbie

Joined: Thu Mar 27, 2008 3:22 pm
Posts: 2
Hibernate version:3.2.4.sp1





Full stack trace of any exception that occurs:
org.hibernate.TransactionException: Could not register synchronization for container transaction
at org.hibernate.transaction.CMTTransaction.begin(CMTTransaction.java:45)
at org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1326)


Name and version of the database you are using: oracle 10

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt: debug



i will apreciate help, i am search in google but i don't find many.

hello, i am run with hibernate good, i haved the transction manager manually and run ok, but now i am tryting of change to EJB/CMT, mi service run before whithout EJB/CMT, i make this to use EJB/CMT

delete the commit and rollback, also the session.begintransaction() and the session.close, y would like that the oc4j make this for me

this is my EJB



Code:

package facade.bean;

import javax.ejb.Stateless;
import javax.ejb.TransactionAttribute;
import javax.ejb.TransactionAttributeType;
import javax.ejb.TransactionManagement;
import javax.ejb.TransactionManagementType;



@Stateless (name = IAdministrativeFacade.JNDI_NAME )

public class AdministrativeBean implements IAdministrativeFacade{

@TransactionAttribute(TransactionAttributeType.REQUIRED)
   public ClientVO registrarTransactionConfig(ClientVO clientVO) throws TxServiceException{
   transactionService.registrateOrUpdateTransactionConfig(clientVO);
}

}



and this is my Transactionserviceimpl

Code:
public class TransactionServiceImpl implements ITransactionService{
   public Object registrateOrUpdateTransactionConfig(ClientVO clientVO) throws TXLogicException {
try
         {
            session=HibernateUtil.currentSession();
//            tr=session.beginTransaction();

//processss
//tr.commit()
}
         catch(Exception e)
         {
            e.printStackTrace();
//            tr.rollback();
            
             

         }
         finally
         {
            if(session!=null)
            {
               session.close();
            }
         }
}
}


and fynally this is the hibernate.cfg.xml

Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
      "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
      "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
    <session-factory>
        <property name="hibernate.connection.datasource">jdbc/CoreTXDS2</property>
<property name="hibernate.dialect">org.hibernate.dialect.OracleDialect</property>
        <property name="hibernate.show_sql">true</property>
        <property name="hibernate.max_fetch_depth">1</property>
        <property name="hibernate.query.factory_class">org.hibernate.hql.classic.ClassicQueryTranslatorFactory</property>
       <property name="hibernate.transaction.factory_class">org.hibernate.transaction.CMTTransactionFactory</property>
      <property name="hibernate.transaction.manager_lookup_class">org.hibernate.transaction.OC4JTransactionManagerLookup</property>
   <property name="hibernate.current_session_context_class">thread</property>
      <property name="hibernate.autocommit">true</property>
      <property name="hibernate.connection.autocommit">true</property>
    </session-factory>
</hibernate-configuration>


many thaks, if some where find documentation please tell me.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 27, 2008 11:38 pm 
Newbie

Joined: Thu Mar 27, 2008 3:22 pm
Posts: 2
or if some one have a hibernate.cfg.xml of example where is configured CMT to run whith EJB in OC4J.

this is my hibernate.cfg.xml
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
      "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
      "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
    <session-factory>
         
        <property name="hibernate.connection.datasource">jdbc/CoreTXDS2</property>
       
       
     
        <property name="hibernate.dialect">org.hibernate.dialect.OracleDialect</property>
        <property name="hibernate.show_sql">true</property>
        <property name="hibernate.max_fetch_depth">1</property>
        <property name="hibernate.query.factory_class">org.hibernate.hql.classic.ClassicQueryTranslatorFactory</property>
<!--           <property name="hibernate.transaction.factory_class">org.hibernate.transaction.JDBCTransactionFactory</property>-->
        
<!--          <property name="transaction.factory.class">org.hibernate.transaction.JTATransactionFactory</property>-->
           <property name="hibernate.transaction.factory_class">org.hibernate.transaction.CMTTransactionFactory</property>
      <property name="hibernate.transaction.manager_lookup_class">org.hibernate.transaction.OC4JTransactionManagerLookup</property>


       <!--  <property name="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</property>-->
      <!-- <property name="hibernate.cache.use_query_cache">false</property>
      -->
      <property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>
    <!-- <property name="hibernate.current_session_context_class">jta</property>-->
       <property name="hibernate.current_session_context_class">thread</property>
      <property name="hibernate.autocommit">false</property>
      <property name="hibernate.connection.autocommit">false</property>
    </session-factory>
</hibernate-configuration>


thanks


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.