-->
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.  [ 1 post ] 
Author Message
 Post subject: Rollback of entities from 2LC not working
PostPosted: Thu Jun 20, 2013 4:18 pm 
Newbie

Joined: Wed Dec 28, 2011 10:57 am
Posts: 2
Hi. We are working with Hibernate 4.1.10 over JBoss 7.1.1. We are using Infinispan as 2LC. Both Hibernate and Infinispan are configured as modules in JBoss and we intend to use default support of infinispan in JBoss7.
We get to deploy the application, but we are having some issues in cases where transactions that make changes over a Session (merge of entities, that are flushed to db) are rolledback. The issue is that the changes are kept in 2LC, so when we try to make the changes over the entities again, we get a "org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction".

May be the problem is our configuration of hibernate+infinispan. We follow several tutorials and forums topics, but none of them seem to change the error.
If we make the same case using JPA insteed of native hibernate, it works fine (i mean, configurating persistence.xml, and using entityManager insteed of hibernate.cfg.xml and SessionFactory).

Our hibernate.cfg.xml:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
                                         "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
   <session-factory>
        <property name="hibernate.connection.datasource">java:jboss/datasources/testjbpm</property>
      <property name="dialect">org.hibernate.dialect.PostgreSQLDialect</property>
      <property name="current_session_context_class">jta</property>
      <property name="hibernate.cache.use_query_cache">true</property>
      <property name="hibernate.cache.use_second_level_cache">true</property>
      <property name="hibernate.cache.region.factory_class">org.jboss.as.jpa.hibernate4.infinispan.InfinispanRegionFactory</property>
      <property name="hibernate.cache.infinispan.cachemanager">java:jboss/infinispan/container/hibernate</property>
      <property name="javax.persistence.sharedCache.mode">ALL</property>
      <property name="hibernate.cache.infinispan.use_synchronization">false</property>
      <property name="hibernate.cache.infinispan.statistics">true</property>
      <property name="generate_statistics">true</property>
      <property name="show_sql">true</property>
      <property name="hibernate.format_sql">false</property>
      <property name="hbm2ddl.auto">update</property>
        <property name="hibernate.transaction.factory_class">org.hibernate.transaction.CMTTransactionFactory</property>
        <property name="hibernate.transaction.jta.platform">org.hibernate.service.jta.platform.internal.JBossAppServerJtaPlatform</property>
        <property name="hibernate.validator.autoregister_listeners">false</property>
      <property name="javax.persistence.validation.mode">none</property>
   </session-factory>
</hibernate-configuration>


If it is necessary, I can attach an example project with an ee application that exposes an EJB with methods to insert and update an entity and a client project (main) that shows the error. I donĀ“t see how to attach it right now :S.

Any ideas or suggestions are welcome.
Thanks in advance.
Pablo


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

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.