Announcement Announcement Module
Collapse
No announcement yet.
Inconsistent LazyInitializationException problem Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Inconsistent LazyInitializationException problem

    I have a Facade class with static methods that call the DAO class (extends HibernateDaoSupport).

    I have getUnitList() and getUnit(String ID) methods in the Facade class.

    When I call getUnitList() in junit, I'm able to get an item in the list and get the associated object. e.g. unit.getSuperUnit().
    However, when I call getUnit(ID), and then I call unit.getSuperUnit(), I get an exception:
    org.hibernate.LazyInitializationException: could not initialize proxy - the owning Session was closed

    I have this bean in my applicationcontext.
    <bean id="unitDAO" class="com.tougher.intranet.employee.unit.dao.Unit DAOHibernate">
    <property name="sessionFactory">
    <ref bean="sessionFactory" />
    </property>
    </bean>

    I'm aware the problem is related to the OpenSessionInView. I can tell you I'm pretty frustrated right now. I've been reading forum entry after forum entry about OpenSessionInView but I can't still get it to work. Is there one definitive article/tutorial that tackles this problem?

    Someone kind enough to explain why I'm not getting that error when I get a list? For now I just want to understand why I'm not getting the exception consistently.

    Thanks!

  • #2
    Maybe you are using session.load inside your getUnit(ID) which will return a proxy which will throw LIE if the object is not found. What is your unitDAO code?

    Comment


    • #3
      Hello Costin,

      Here are my DAO methods...
      if I don't call the u.getSuperUnit.getName part, I get the exception.
      For the list, I just use the ordinary list() method.

      public Unit getUnit(final String unitCode) {
      HibernateCallback hc = new HibernateCallback() {
      public Object doInHibernate(Session s) throws HibernateException,
      SQLException {
      Unit u = (Unit) s.get(Unit.class, new Long(unitCode));
      if (u.getSuperUnit() != null) {
      u.getSuperUnit().getUnitName();
      }
      return u;
      }
      };
      return (Unit) getHibernateTemplate().execute(hc);
      }

      public List getUnitList() {
      return getHibernateTemplate().findByNamedQuery("getUnitLi st");
      }

      Comment


      • #4
        f I don't call the u.getSuperUnit.getName part, I get the exception.
        For the list, I just use the ordinary list() method.
        HibernateTemplate uses for retrieving the object a new hibernate session that is closed after the callback is executed. If you want to enable lazy loading outside the callback then you can use OpenSessionInView interceptor or Filter. You can turn on logging and see if the session is bound to the thread and if the template will use it or will create a another one.

        Comment


        • #5
          Hi Costin,

          Thanks for your help.
          I understand the need for OpenSessionInView and how the LazyInitializationException is related to it.
          However for now, I just like to understand why I am not getting the LazyInitializationException consistently.
          Maybe you can see the problem better if I give my classes...

          As it is, the unit test will fail in the first one but not on the second one,
          even though both tests accesses a related object.
          What I want to know is why the getUnitList is not throwing LazyInitializationException.

          Secondly, I'm trying first to simulate OpenSessionInView in my unit test.
          Basing from this forum entry: http://forum.springframework.org/showthread.php?t=9630
          I've added the codes, but still I get the LazyInitializationException.
          Also, the tearDown method throws java.lang.IllegalStateException: No value for key [org.hibernate.impl.SessionFactoryImpl@ab7165] bound to thread [main]

          I'm beginning to think I did something wrong in the config, but I have no idea what it is.
          In particular, I don't understand if I need the transactionManager or not. I've seen some code examples with it and some without it.

          Thanks!


          SpringUtil.java
          Code:
          public class SpringUtil {
          
          	public static ApplicationContext getContext() {
          		String[] paths = { "spring.xml" };
          		ApplicationContext ctx = new ClassPathXmlApplicationContext(paths);
          		return ctx;
          	}
          	public static Object getBean(String beanName) {
          		return getContext().getBean(beanName);
          	}
          }
          spring.xml
          Code:
          <?xml version="1.0" encoding="UTF-8"?>
          
          <!DOCTYPE beans PUBLIC
              "-//SPRING//DTD BEAN//EN"
              "http://www.springframework.org/dtd/spring-beans.dtd">
          
          <beans default-autowire="no" default-lazy-init="false"
          	default-dependency-check="none">
          
          	<bean id="dataSource"
          		class="org.springframework.jdbc.datasource.DriverManagerDataSource">
          		<property name="driverClassName">
          			<value>com.mysql.jdbc.Driver</value>
          		</property>
          		<property name="url">
          			<value>jdbc:mysql://localhost:3300/miniintranet</value>
          		</property>
          		<property name="username">
          			<value>root</value>
          		</property>
          		<property name="password">
          			<value>root</value>
          		</property>
          	</bean>
          
          	<bean id="sessionFactory"
          		class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
          		<property name="dataSource">
          			<ref local="dataSource" />
          		</property>
          		<property name="mappingResources">
          			<list>
          				<value>
          					com/tougher/intranet/employee/unit/Unit.hbm.xml
          				</value>
          			</list>
          		</property>
          		<property name="hibernateProperties">
          			<props>
          				<prop key="hibernate.dialect">
          					org.hibernate.dialect.MySQLDialect
          				</prop>
          				<prop key="hibernate.hbm2ddl.auto">update</prop>
          				<prop key="show_sql">true</prop>
          
          			</props>
          		</property>
          	</bean>
          
          	<bean id="unitDAO"
          		class="com.tougher.intranet.employee.unit.dao.UnitDAOHibernate">
          
          		<property name="sessionFactory">
          			<ref bean="sessionFactory" />
          		</property>
          	</bean>
          
          	<bean id="transactionManager"
          		class="org.springframework.orm.hibernate3.HibernateTransactionManager">
          		<property name="sessionFactory">
          			<ref local="sessionFactory" />
          		</property>
          	</bean>
          
          </beans>
          UnitDAOHibernate
          Code:
          public class UnitDAOHibernate extends HibernateDaoSupport {
          	public Unit getUnit(String unitCode) {
          		return (Unit)getHibernateTemplate().get(Unit.class,new Long(unitCode));
          	}
          	public List getUnitList() {
          		return getHibernateTemplate().findByNamedQuery("getUnitList");
          	}
          }
          UnitService
          Code:
          public class UnitService {
          
          	private static UnitDAOHibernate dao = (UnitDAOHibernate)SpringUtil.getContext().getBean("unitDAO");
          
          	public static Unit getUnit(String unitCode) {
          		return dao.getUnit(unitCode);
          	}
          
          	public static List getUnitList() {
          		return dao.getUnitList();
          	}
          UnitServiceTest
          Code:
          public class UnitServiceTest extends TestCase {
          	public void setUp() throws Exception {
          		String sqlDir = ProgramAttributes.getProperty("sqlDir");
          		HibernateUtil.runStatement("DELETE FROM Unit ORDER BY unitCode DESC");
          		String statement = FileUtil.fileToString(new File(sqlDir + "Unit.sql"));
          		HibernateUtil.runStatement(statement);
          	}
          	public void testgetUnit() throws Exception {
          		Unit unit= UnitService.getUnit("1");
          		assertEquals("ABS-OSD", unit.getUnitName());
          		unit= UnitService.getUnit("2");
          		assertEquals("Tech Team", unit.getUnitName());
          		assertEquals("ABS-OSD", unit.getSuperUnit().getUnitName());
          	}
          
          	public void testgetUnitList() throws Exception {
          		List l = UnitService.getUnitList();
          		assertEquals(11, l.size());
          		Unit u = (Unit) l.get(0);
          		assertEquals("ABS-OSD", u.getUnitName());
          		assertEquals(null, u.getSuperUnit());
          		u = (Unit) l.get(10);
          		assertEquals("Tech Team", u.getUnitName());
          		assertEquals("ABS-OSD", u.getSuperUnit().getUnitName());
          
          		HibernateUtil.runStatement("DELETE FROM Unit ORDER BY unitCode DESC");
          		l = UnitService.getUnitList();
          		assertEquals(0, l.size());
          	}

          Comment


          • #6
            When you need OpenSessionInView I advice you to take a look at the unit tests support provided by Spring - org.springframework.test - especially AbstractTransactionalSpringContextTests. The test not only reads your application context but also rans each test inside its own transaction. The main advantage is that after each test the transaction is rolled back by default so the changes to the database are not persisted.
            Related to your problem, the transaction will actually bind a session to the thread which will be available to components aware of it (like HibernateTemplate).

            There have been quite a number of thread related to the test suite - search the forum. Also some nice explanations are given in the reference documentation and javadocs.

            Comment


            • #7
              Costin,

              I tried using the abstract class you provided, and I'm having some problems with it.
              a. it runs very slowly, compared to my old one. I've read in forum entries and the API documentation that it should be faster than conventional ones.
              b. my unit test fails in getUnitList. it is getting the existing data in the database, instead of getting the init data in the setup method... i.e. it is getting 13 records (from the database) instead of the 11 records in the setup method.

              Regarding the transaction manager. Why is it my code works (it can query and can update db) even if there is no transaction manager in my spring.xml?

              You stated that "the transaction will actually bind a session to the thread which will be available to components aware of it" If I don't have a transaction manager, what happens? If there is no session bound to the thread, shouldn't there be an error thrown?

              Code:
              public class UnitServiceTest extends
              		AbstractTransactionalDataSourceSpringContextTests {
              
              	protected void flush() {
              		HibernateTemplate hibernateTemplate = new HibernateTemplate(
              				(SessionFactory) SpringUtil.getBean("sessionFactory"));
              		hibernateTemplate.flush();
              	}
              
              	protected String[] getConfigLocations() {
              		return new String[] { "spring.xml" };
              	}
              
              	protected void onSetUpInTransaction() throws Exception {
              		String sqlDir = ProgramAttributes.getProperty("sqlDir");
              		jdbcTemplate.execute("DELETE FROM Unit ORDER BY unitCode DESC");
              		//HibernateUtil.runStatement("DELETE FROM Unit ORDER BY unitCode DESC");
              		String statement = FileUtil.fileToString(new File(sqlDir + "Unit.sql"));
              		jdbcTemplate.execute(statement);
              		//HibernateUtil.runStatement(statement);
              		flush();
              		int i = jdbcTemplate.queryForInt("SELECT COUNT(*) FROM Unit");
              		System.out.println(i);
              	}
              
              	public void onTearDownAfterTransaction() throws Exception {
              
              	}
              
              	public void testgetUnit() throws Exception {
              		Unit unit = UnitService.getUnit("1");
              		assertEquals("ABS-OSD", unit.getUnitName());
              		unit = UnitService.getUnit("2");
              		assertEquals("Tech Team", unit.getUnitName());
              		assertEquals("ABS-OSD", unit.getSuperUnit().getUnitName());
              	}
              
              	public void testgetUnitList() throws Exception {
              		flush();
              		List l = UnitService.getUnitList();
              		assertEquals(11, l.size());
              		Unit u = (Unit) l.get(0);
              		assertEquals("ABS-OSD", u.getUnitName());
              		assertEquals(null, u.getSuperUnit());
              		u = (Unit) l.get(10);
              		assertEquals("Tech Team", u.getUnitName());
              		assertEquals("ABS-OSD", u.getSuperUnit().getUnitName());
              
              		//HibernateUtil.runStatement("DELETE FROM Unit ORDER BY unitCode DESC");
              		jdbcTemplate.execute("DELETE FROM Unit ORDER BY unitCode DESC");
              		flush();
              		l = UnitService.getUnitList();
              		assertEquals(0, l.size());
              	}

              Comment


              • #8
                a. it runs very slowly, compared to my old one. I've read in forum entries and the API documentation that it should be faster than conventional ones.
                It runs slows only when your application context is loaded - the slowness comes from the application context beans actually. After that, the context is closed and you don't have any loading penalty.
                my unit test fails in getUnitList. it is getting the existing data in the database, instead of getting the init data in the setup method... i.e. it is getting 13 records (from the database) instead of the 11 records in the setup method.
                Most probably the problem is caused by the fact that you are using both jdbcTemplate and the HibernateTemplate - if they are not properly configured the changes from teh jdbcTemplate will not be seen only at the end of the transaction.
                You can move your code into OnSetupBeforeTranscation method and turn on logging to make sure the changes are persisted into your database.

                Regarding the transaction manager. Why is it my code works (it can query and can update db) even if there is no transaction manager in my spring.xml?

                You stated that "the transaction will actually bind a session to the thread which will be available to components aware of it" If I don't have a transaction manager, what happens? If there is no session bound to the thread, shouldn't there be an error thrown?
                The session bind to the thread is actually the threadlocal-session pattern (this the expression used by the Hibernate team I think). If you have it then the same session can be used across the code and thus lazy loading can be used - if it's not available/used then you get LIE since you the session used to get some objects has been closed and their relations can't be resolved anymore.
                So to answer your question, if you don't have a transcation manager then obviously the changes to the database won't be rolled back (since there are no transactions) and there will be no session bind to the thread (which is actually a side effect of transactions).

                Comment


                • #9
                  I've changed the method from In to Before.
                  My unit test for getUnit is now ok, except that the promise of the transaction being rollbacked is not being met.
                  My database is still changing.

                  The getUnitList method is not ok, because I want to delete everything and expecting a zero size list. I called flush but it does not seem to be working...

                  I'll post everything here, please try and see what I have done wrong...

                  Unit Test:
                  Code:
                  public class SpringUnitServiceTest extends
                  		AbstractTransactionalDataSourceSpringContextTests {
                  
                  	protected String[] getConfigLocations() {
                  		return new String[] { "spring.xml" };
                  	}
                  
                  	protected void flush() {
                  		HibernateTemplate hibernateTemplate = new HibernateTemplate(
                  				(SessionFactory) SpringUtil.getBean("sessionFactory"));
                  		hibernateTemplate.flush();
                  	}
                  
                  	protected void onSetUpBeforeTransaction() throws Exception {
                  		String sqlDir = ProgramAttributes.getProperty("sqlDir");
                  		jdbcTemplate.execute("DELETE FROM Unit ORDER BY unitCode DESC");
                  		String statement = FileUtil.fileToString(new File(sqlDir + "Unit.sql"));
                  		jdbcTemplate.execute(statement);
                  		flush();
                  		int count = jdbcTemplate.queryForInt("SELECT COUNT(*) FROM Unit");
                  		System.out.println("count: " + count);
                  	}
                  
                  	public void testgetUnit() throws Exception {
                  		int count = jdbcTemplate.queryForInt("SELECT COUNT(*) FROM Unit");
                  		System.out.println("count: " + count);
                  		Unit u = UnitService.getUnit("1");
                  		assertEquals("ABS-OSD", u.getUnitName());
                  		assertEquals(null, u.getSuperUnit());
                  		u = UnitService.getUnit("2");
                  		assertEquals("Tech Team", u.getUnitName());
                  		assertEquals("1", u.getSuperUnitCode());
                  		assertEquals("1", u.getSuperUnit().getUnitCode().toString());
                  		assertEquals("ABS-OSD", u.getSuperUnit().getUnitName());
                  	}
                  
                  	public void testgetUnitList() throws Exception {
                  		List l = UnitService.getUnitList();
                  		assertEquals(11, l.size());
                  		Unit u = (Unit) l.get(0);
                  		assertEquals("ABS-OSD", u.getUnitName());
                  		assertEquals(null, u.getSuperUnit());
                  		u = (Unit) l.get(10);
                  		assertEquals("Tech Team", u.getUnitName());
                  		assertEquals("ABS-OSD", u.getSuperUnit().getUnitName());
                  
                  		jdbcTemplate.execute("DELETE FROM Unit ORDER BY unitCode DESC");
                  		flush();
                  		l = UnitService.getUnitList();
                  		assertEquals(0, l.size());
                  	}
                  }
                  Unit Service:
                  Code:
                  public class UnitService {
                  
                  	private static UnitDAOHibernate dao = (UnitDAOHibernate) SpringUtil
                  			.getBean("unitDAO");
                  
                  	public static List getUnitList() {
                  		return dao.getUnitList();
                  	}
                  
                  	public static List getUnitListWithNone() {
                  		List l = dao.getUnitList();
                  		Unit u = new Unit();
                  		u.setUnitCode(new Long(Unit.NONE));
                  		u.setUnitName("None");
                  		l.add(0, u);
                  		return l;
                  	}
                  
                  	public static List getUnitListSubset(SearchUnit searchUnit) {
                  		return dao.getUnitListSubset(searchUnit);
                  	}
                  
                  	public static Integer getUnitListSubsetCount(SearchUnit searchUnit) {
                  		return dao.getUnitListSubsetCount(searchUnit);
                  	}
                  
                  	public static void addUnit(Unit unit) {
                  		dao.addUnit(unit);
                  	}
                  
                  	public static void updateUnit(Unit unit) {
                  		Unit u2 = getUnit("" + unit.getUnitCode());
                  		u2.setSuperUnit(unit.getSuperUnit());
                  		u2.setUnitName(unit.getUnitName());
                  		dao.updateUnit(u2);
                  	}
                  
                  	public static void deleteUnit(Unit unit) {
                  		Unit u2 = getUnit(unit.getUnitCode().toString());
                  		dao.deleteUnit(u2);
                  	}
                  
                  	public static Unit getUnit(String unitCode) {
                  		return dao.getUnit(unitCode);
                  	}
                  
                  }
                  Unit DAO:
                  Code:
                  public class UnitDAOHibernate extends HibernateDaoSupport {
                  	private static final Logger log = Logger.getLogger(UnitDAOHibernate.class);
                  
                  	public Unit getUnit(final String unitCode) {
                  		HibernateCallback hc = new HibernateCallback() {
                  			public Object doInHibernate(Session s) throws HibernateException,
                  					SQLException {
                  				Unit u = (Unit) s.get(Unit.class, new Long(unitCode));
                  				if (u.getSuperUnit() != null) {
                  					//u.getSuperUnit().getUnitName();
                  				}
                  				return u;
                  			}
                  		};
                  		return (Unit) getHibernateTemplate().execute(hc);
                  	}
                  
                  	public List getUnitList() {
                  		return getHibernateTemplate().findByNamedQuery("getUnitList");
                  	}
                  
                  	public List getUnitListSubset(final SearchUnit searchUnit) {
                  		final int maxPageItems = Integer.parseInt(ProgramAttributes
                  				.getProperty("maxPageItems"));
                  		final int itemOffset = searchUnit.getItemNumberAsInt();
                  		log.debug("itemOffset: " + itemOffset);
                  
                  		HibernateCallback hc = new HibernateCallback() {
                  			public Object doInHibernate(Session s) throws HibernateException,
                  					SQLException {
                  				String queryName = "getUnitListBySubstring";
                  				if (SearchUnit.SEARCH_BY_SUPER_UNIT.equals(searchUnit
                  						.getSearchType())) {
                  					if (!Unit.NONE.equals(searchUnit.getSuperUnitCode())) {
                  						queryName = "getUnitListBySuperUnit";
                  					} else {
                  						queryName = "getUnitListBySuperUnitNull";
                  					}
                  				}
                  				Query q = s.getNamedQuery(queryName);
                  				q.setFirstResult(itemOffset);
                  				q.setMaxResults(maxPageItems);
                  				if (SearchUnit.SEARCH_BY_SUPER_UNIT.equals(searchUnit
                  						.getSearchType())) {
                  					String superUnitCode = searchUnit.getSuperUnitCode();
                  					if (!Unit.NONE.equals(superUnitCode)) {
                  						q.setLong(0, Long.parseLong(superUnitCode));
                  					}
                  				} else {
                  					q.setString(0, "%" + searchUnit.getUnitSubstring() + "%");
                  				}
                  				return q.list();
                  			}
                  		};
                  
                  		List l = (List) getHibernateTemplate().execute(hc);
                  		return l;
                  	}
                  
                  	public Integer getUnitListSubsetCount(final SearchUnit searchUnit) {
                  		HibernateCallback hc = new HibernateCallback() {
                  			public Object doInHibernate(Session s) throws HibernateException,
                  					SQLException {
                  				String queryName = "getUnitListBySubstringCount";
                  				if (SearchUnit.SEARCH_BY_SUPER_UNIT.equals(searchUnit
                  						.getSearchType())) {
                  					if (!Unit.NONE.equals(searchUnit.getSuperUnitCode())) {
                  						queryName = "getUnitListBySuperUnitCount";
                  					} else {
                  						queryName = "getUnitListBySuperUnitNullCount";
                  					}
                  				}
                  
                  				Query q = s.getNamedQuery(queryName);
                  				if (SearchUnit.SEARCH_BY_SUPER_UNIT.equals(searchUnit
                  						.getSearchType())) {
                  					String superUnitCode = searchUnit.getSuperUnitCode();
                  					if (!Unit.NONE.equals(superUnitCode)) {
                  						q.setLong(0, Long.parseLong(superUnitCode));
                  					}
                  				} else {
                  					q.setString(0, "%" + searchUnit.getUnitSubstring() + "%");
                  				}
                  				Integer count = (Integer) q.list().get(0);
                  				log.debug(count);
                  				return count;
                  			}
                  		};
                  
                  		Integer count = (Integer) getHibernateTemplate().execute(hc);
                  		return count;
                  	}
                  }
                  spring.xml:
                  Code:
                  <?xml version="1.0" encoding="UTF-8"?>
                  
                  <!DOCTYPE beans PUBLIC
                      "-//SPRING//DTD BEAN//EN"
                      "http://www.springframework.org/dtd/spring-beans.dtd">
                  
                  <beans
                    default-autowire="no"
                    default-lazy-init="false"
                    default-dependency-check="none"
                  >
                  
                    <bean
                        id="unitDAO"
                        class="com.tougher.intranet.employee.unit.dao.UnitDAOHibernate"
                    >
                  
                      <property name="sessionFactory">
                        <ref bean="sessionFactory"/>
                      </property>
                    </bean>
                  
                    <bean
                        id="unitServiceTarget"
                        class="com.tougher.intranet.employee.unit.UnitService"
                    >
                  
                    </bean>
                  
                  <bean id="dataSource"
                  	class="org.springframework.jdbc.datasource.DriverManagerDataSource">
                  	<property name="driverClassName">
                  		<value>com.mysql.jdbc.Driver</value>
                  	</property>
                  	<property name="url">
                  		<value>jdbc:mysql://localhost:3306/miniintranet</value>
                  	</property>
                  	<property name="username">
                  		<value>root</value>
                  	</property>
                  	<property name="password">
                  		<value>root</value>
                  	</property>
                  </bean>
                  
                  <bean id="sessionFactory"
                  	class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
                  	<property name="dataSource">
                  		<ref local="dataSource" />
                  	</property>
                  	<property name="mappingResources">
                  		<list>
                  			<value>
                  				com/tougher/intranet/employee/unit/Unit.hbm.xml
                  			</value>
                  		</list>
                  	</property>
                  	<property name="hibernateProperties">
                  		<props>
                  			<prop key="hibernate.dialect">
                  				org.hibernate.dialect.MySQLDialect
                  			</prop>
                  			<prop key="hibernate.hbm2ddl.auto">update</prop>
                  			<prop key="show_sql">true</prop>
                  
                  		</props>
                  	</property>
                  </bean>
                  
                  <bean id="urlMapping"
                  	class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
                  	<property name="interceptors">
                  		<list>
                  			<ref bean="openSessionInViewInterceptor" />
                  		</list>
                  	</property>
                  </bean>
                  <bean name="openSessionInViewInterceptor"
                  	class="org.springframework.orm.hibernate3.support.OpenSessionInViewInterceptor">
                  	<property name="sessionFactory">
                  		<ref bean="sessionFactory" />
                  	</property>
                  </bean>
                  
                  <bean id="transactionManager"
                  	class="org.springframework.orm.hibernate3.HibernateTransactionManager">
                  	<property name="sessionFactory">
                  		<ref local="sessionFactory" />
                  	</property>
                  </bean>
                  
                  <!-- Transaction template for Services -->
                  <bean id="unitService"
                  	class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
                  	<property name="target">
                  		<ref bean="unitServiceTarget" />
                  	</property>
                  	<property name="transactionManager">
                  		<ref bean="transactionManager" />
                  	</property>
                  	<property name="transactionAttributes">
                  		<props>
                  			<prop key="save*">PROPAGATION_REQUIRED</prop>
                  			<prop key="delete*">PROPAGATION_REQUIRED</prop>
                  			<prop key="update*">PROPAGATION_REQUIRED</prop>
                  			<prop key="get*">PROPAGATION_REQUIRED,readOnly</prop>
                  		</props>
                  	</property>
                  </bean>
                  
                  </beans>

                  Comment


                  • #10
                    You need to use MySQL with InnoDB tables - MyISAM are not transactional. Change your dialect to MySQLInnoDB also.

                    Comment


                    • #11
                      Hi Costin,

                      I've changed the dialect to org.hibernate.dialect.MySQLInnoDBDialect
                      The same problem, even with flush, the jdbcTemplate statement is not being executed/reflected...

                      Comment

                      Working...
                      X