Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernate Session problem

 
Ghaith Shamayleh
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I used hibernate for the web app

every time i perform a database transaction with the same arguments I get different data and some data on the session disappears i get null pointer exception
what could be the problem

<session-factory>
<property name="dialect">
org.hibernate.dialect.Oracle9Dialect
</property>
<property name="connection.url">
jdbcracle:thin:@10.11.45.200:1521rcl
</property>
<property name="connection.username">cert</property>
<property name="connection.password">cert</property>
<property name="connection.driver_class">
oracle.jdbc.driver.OracleDriver
</property>
<property name="myeclipse.connection.profile">CertDB</property>
<!-- JDBC connection pool (use the built-in) -->
<property name="connection.pool_size">10</property>

<property name="current_session_context_class">thread</property>

<property name="hibernate.cache.use_second_level_cache">false</property>


<property name="hibernate.cache.provider_class">org.hibernate.cache.NoCacheProvider</property>




<property name="show_sql">true</property>
<property name="hbm2ddl.auto">validate</property>





<property name="cache.provider_class">
org.hibernate.cache.NoCacheProvider
</property>

<property name="show_sql">true</property>
<property name="hbm2ddl.auto">validate</property>

<property name="hibernate.jdbc.batch_size">20</property>





<mapping resource="map/ServerSites.hbm.xml" /


______________public T getById(Serializable simpleId) {
Session sess = getSession();
Transaction tx = null;
try {
tx = sess.beginTransaction();
T obj = (T) sess.load(getEntityClass(), simpleId);

tx.commit();
return obj;
} catch (Exception e) {

if (tx != null) {
tx.rollback();
}
return null;
} finally {
sess.close();
closeSession();
}
}
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic