Joined: Fri Jan 13, 2006 11:49 am Posts: 1
|
Post
Install : Oracle 9i - Jboss 4.0.2 - Hibernate 3.0.5 - JDK1.5
we have got many application in production. These are packaged as wars. Here is our configuration.
OracleDS:
<datasources>
<local-tx-datasource>
<jndi-name>OracleDS</jndi-name>
<connection-url>jdbc:oracle:thin:@xxx:1521:xxx</connection-url>
<driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
<user-name>xxx</user-name>
<password>xxx</password>
<min-pool-size>0</min-pool-size>
<max-pool-size>30</max-pool-size>
<exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name>
<metadata>
<type-mapping>Oracle9i</type-mapping>
</metadata>
</local-tx-datasource>
</datasources>
hibernate.cfg.xml:
<hibernate-configuration>
<session-factory>
<!-- datasource connection properties -->
<property name="connection.datasource">java:/OracleDS</property>
<!-- dialect for Oracle 9 -->
<property name="dialect">org.hibernate.dialect.Oracle9Dialect</property>
<property name="hibernate.show_sql">false</property>
<property name="hibernate.transaction.manager_lookup_class">org.hibernate.transaction.JBossTransactionManagerLookup</property>
</session-factory>
</hibernate-configuration>
Fecth the session factory:
private Session newSession() {
synchronized (configuration) {
if (sessionFactory == null) {
if (logger.isInfoEnabled()) {
logger.info("HiberConf - initialize sessionFactory");
}
sessionFactory = configuration.buildSessionFactory();
}
return sessionFactory.openSession();
}
}
And DefaultDatasource is set to OracleDS in the standardjbosscmp.xml.
No Hibernate Mbean added in JBoss...
Here is an example of request :
public List getAgentsParResponsableProjet(Integer idResponsable) {
List agents = null;
Transaction tx = null;
synchronized (this) {
try {
session = HibernateUtil.currentSession();
tx = session.beginTransaction();
agents = session.createQuery(
"from ActiviteAffectee aa where aa.Idresponsable='" + idResponsable.toString() + "'")
.list();
tx.commit();
} catch (Exception ex) {
if (tx != null) {
tx.rollback();
}
if (log.isErrorEnabled()) {
log.error("getAgentsParResponsableProjet", ex);
}
} finally {
HibernateUtil.closeSession();
}
}
return agents;
}
We are just wondering if we have got the right configuration for the couple JBoss-Hibernate.
Because we have got stranges errors like synchronisation of TransactionManager the are happening sometimes.
We really need help cause these apps are in production and we couldn't make a test period for these apps...
|
|