-->
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.  [ 33 posts ]  Go to page 1, 2, 3  Next
Author Message
 Post subject: Persisting and retrieving a collection property
PostPosted: Wed Jul 21, 2010 5:09 am 
Pro
Pro

Joined: Mon Apr 16, 2007 8:10 am
Posts: 246
Hello,

I have a Form object containing several FormItem objects in a property.

Here is the model:
Code:
public class Form implements java.io.Serializable {

   private Integer id;
   private int version;
   private String name;
   private Set<FormItem> formItems = new HashSet<FormItem>(0);
...
}

public class FormItem implements java.io.Serializable {

   private Integer id;
   private int version;
   private String type;
   private String name;
   private Form form;
...
}


The test that fails:
Code:
   @Test
   public void testCollection() {
      formItem0 = new FormItem();
      formItem0.setName("name");
      formItem0.setListOrder(2);
      formItem0.setType("itemtype");
      formItem0.setForm(form0);
      formItem1 = new FormItem();
      formItem1.setName("name");
      formItem1.setListOrder(1);
      formItem1.setType("itemtype");
      formItem1.setForm(form0);
      form0 = formDao.makePersistent(form0);
      formItem0 = formItemDao.makePersistent(formItem0);
      formItem1 = formItemDao.makePersistent(formItem1);
      Form retrievedForm = formDao.findById(form0.getId(), false);
      retrievedForm = formDao.findById(form0.getId(), false);
      assertEquals(2, retrievedForm.getFormItems().size());
   }


with the exception:
Quote:
FormDaoTest@80669d, testMethod = testCollection@FormDaoTest, testException = java.lang.NullPointerException]]


The test class constructor:
Code:
   public FormDaoTest() {
      form0 = new Form();
      form0.setName(name0);
      form1 = new Form();
      form1.setName(name1);
      form1.setImage(image);
   }

Note that the other following test works fine:
Code:
   @Test
   public void testSaveAndRetrieve() {
      form0 = formDao.makePersistent(form0);
      assertNotNull(form0.getId());
      assertNotSame(form0.hashCode(), 0L);
      assertFalse(form0.toString().equals(""));
      Form retrievedForm = formDao.findById(form0.getId(), false);
      assertEquals(form0.hashCode(), retrievedForm.hashCode());
      assertEquals(form0.getName(), retrievedForm.getName());
      assertNotNull(retrievedForm.getId());
   }


The hibernate mapping:
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!-- Generated Apr 18, 2010 1:03:51 PM by Hibernate Tools 3.2.1.GA -->
<hibernate-mapping>
    <class name="core.domain.Form" table="form" dynamic-insert="true" dynamic-update="true">
        <id name="id" type="java.lang.Integer">
            <column name="id" />
            <generator class="identity" />
        </id>
        <version name="version" type="int">
            <column name="version" not-null="true" />
        </version>
        <property name="name" type="string">
            <column name="name" length="50" not-null="true" />
        </property>
        <property name="description" type="string">
            <column name="description" not-null="false" />
        </property>
        <set name="formItems" inverse="true">
            <key>
                <column name="form_id" not-null="false" />
            </key>
            <one-to-many class="core.domain.FormItem" />
        </set>
    </class>
</hibernate-mapping>

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!-- Generated Apr 18, 2010 1:03:51 PM by Hibernate Tools 3.2.1.GA -->
<hibernate-mapping>
    <class name="core.domain.FormItem" table="form_item" dynamic-insert="true" dynamic-update="true">
        <id name="id" type="java.lang.Integer">
            <column name="id" />
            <generator class="identity" />
        </id>
        <version name="version" type="int">
            <column name="version" not-null="true" />
        </version>
        <many-to-one name="form" class="core.domain.Form" cascade="all" fetch="select">
            <column name="form_id" not-null="true" />
        </many-to-one>
        <property name="type" type="string">
            <column name="type" length="50" not-null="true" />
        </property>
        <property name="name" type="string">
            <column name="name" length="50" not-null="false" />
        </property>
        <property name="listOrder" type="int">
            <column name="list_order" not-null="true" />
        </property>
    </class>
</hibernate-mapping>


The issue I have is with the test that tries to persist and retrieve the formItems proprety of the form object. This property is a collection, of objects of type FormItem.

I'm a bit lost when it comes to persisting and retrieving this collection...

Is my mapping okay ? Do I need to call these makePersistent dao methods ?

If anyone has a better understanding on how to persist a collection property, I'm all ears :-)

Thanks for any tips..

Stephane


Top
 Profile  
 
 Post subject: Re: Persisting and retrieving a collection property
PostPosted: Wed Jul 21, 2010 7:07 am 
Beginner
Beginner

Joined: Tue Jun 30, 2009 7:05 am
Posts: 29
Location: Italy
It looks like there is a problem on the FormItems. Somthing is null, I guess it's the form
Try to swap some lines of code: try to save the object form0 before setting it in the form items
Code:
   @Test
   public void testCollection() {
      // saving the form
      form0 = formDao.makePersistent(form0);

      // creating the items
      formItem0 = new FormItem();
      formItem0.setName("name");
      formItem0.setListOrder(2);
      formItem0.setType("itemtype");
      formItem0.setForm(form0);
      formItem1 = new FormItem();
      formItem1.setName("name");
      formItem1.setListOrder(1);
      formItem1.setType("itemtype");
      formItem1.setForm(form0);
      formItem0 = formItemDao.makePersistent(formItem0);
      formItem1 = formItemDao.makePersistent(formItem1);
      Form retrievedForm = formDao.findById(form0.getId(), false);
      retrievedForm = formDao.findById(form0.getId(), false);
      assertEquals(2, retrievedForm.getFormItems().size());
   }


Top
 Profile  
 
 Post subject: Re: Persisting and retrieving a collection property
PostPosted: Wed Jul 21, 2010 9:15 am 
Pro
Pro

Joined: Mon Apr 16, 2007 8:10 am
Posts: 246
So I moved the code line to persist the form above in the method as in

Code:
   @Test
   public void testCollection() {
      form0 = formDao.makePersistent(form0);
      formItem0 = new FormItem();
      formItem0.setName("name");
      formItem0.setListOrder(2);
      formItem0.setType("itemtype");
      formItem0.setForm(form0);
      formItem1 = new FormItem();
      formItem1.setName("name");
      formItem1.setListOrder(1);
      formItem1.setType("itemtype");
      formItem1.setForm(form0);
      formItem0 = formItemDao.makePersistent(formItem0);
//      formItem1 = formItemDao.makePersistent(formItem1);
//      Form retrievedForm = formDao.findById(form0.getId(), false);
//      retrievedForm = formDao.findById(form0.getId(), false);
//      assertEquals(2, retrievedForm.getFormItems().size());
   }


but I still get a similar exception at the last uncommented line
formItem0 = formItemDao.makePersistent(formItem0);

Here is the exception
Quote:
core.dao.FormDaoTest@5861, testMethod = testCollection@FormDaoTest, testException = java.lang.NullPointerException]]


Top
 Profile  
 
 Post subject: Re: Persisting and retrieving a collection property
PostPosted: Wed Jul 21, 2010 10:30 am 
Beginner
Beginner

Joined: Tue Jun 30, 2009 7:05 am
Posts: 29
Location: Italy
Hi Stephane
can you post the code of your DAO classes?
And can you see the full stack-trace of the exception?


Top
 Profile  
 
 Post subject: Re: Persisting and retrieving a collection property
PostPosted: Wed Jul 21, 2010 10:55 am 
Pro
Pro

Joined: Mon Apr 16, 2007 8:10 am
Posts: 246
Here is the full stack trace of the exception
Quote:
Hibernate:
insert
into
form
(version, name, id)
values
(?, ?, null)
17:51:21,946 DEBUG IntegerType:133 - binding '0' to parameter: 1
17:51:21,947 DEBUG StringType:133 - binding 'form0' to parameter: 2
Hibernate:
call identity()
17:51:21,949 INFO TransactionalTestExecutionListener:279 - Rolled back transaction after test execution for test context [[TestContext@168afdd testClass = FormDaoTest, locations = array<String>['classpath:spring-hibernate.xml', 'classpath:spring-hibernate-dao.xml', 'classpath:spring-data-source.xml'], testInstance = com.thalasoft.learnintouch.core.dao.FormDaoTest@17f1d92, testMethod = testCollection@FormDaoTest, testException = java.lang.NullPointerException]]
org.apache.maven.surefire.booter.SurefireExecutionException: org/junit/Assume$AssumptionViolatedException; nested exception is java.lang.NoClassDefFoundError: org/junit/Assume$AssumptionViolatedException
java.lang.NoClassDefFoundError: org/junit/Assume$AssumptionViolatedException
at org.springframework.test.context.junit4.SpringMethodRoadie.runTestMethod(SpringMethodRoadie.java:240)
at org.springframework.test.context.junit4.SpringMethodRoadie$RunBeforesThenTestThenAfters.run(SpringMethodRoadie.java:333)
at org.springframework.test.context.junit4.SpringMethodRoadie.runWithRepetitions(SpringMethodRoadie.java:217)
at org.springframework.test.context.junit4.SpringMethodRoadie.runTest(SpringMethodRoadie.java:197)
at org.springframework.test.context.junit4.SpringMethodRoadie.run(SpringMethodRoadie.java:143)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.invokeTestMethod(SpringJUnit4ClassRunner.java:160)
at org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:61)
at org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:54)
at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:34)
at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:44)
at org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:52)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:97)
at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62)
at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140)
at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:127)
at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:345)
at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1009)
17:51:21,955 INFO GenericApplicationContext:815 - Closing org.springframework.context.support.GenericApplicationContext@1b60280: display name [org.springframework.context.support.GenericApplicationContext@1b60280]; startup date [Wed Jul 21 17:51:11 EEST 2010]; root of context hierarchy
17:51:21,955 INFO DefaultListableBeanFactory:421 - Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@2f0df1: defining beans [sessionFactory,transactionManager,hibernateTemplate,org.springframework.beans.factory.annotation.RequiredAnnotationBeanPostProcessor#0,addressDao,adminDao,adminModuleDao,adminOptionDao,clientDao,contactDao,contactStatusDao,contactRefererDao,containerDao,contentImportDao,contentImportHistoryDao,documentCategoryDao,documentDao,flashDao,formDao,formItemDao,formItemValueDao,formValidDao,userDao,preferenceDao,webpageDao,webpageDirectoryDao,dataSource,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor]; root of factory hierarchy
17:51:21,957 INFO LocalSessionFactoryBean:246 - Closing Hibernate SessionFactory
17:51:21,957 INFO SessionFactoryImpl:816 - closing
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] There are test failures.

Please refer to /home/stephane/dev/java/projects/learnintouch/core/target/surefire-reports for the individual test results.
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 30 seconds
[INFO] Finished at: Wed Jul 21 17:51:22 EEST 2010
[INFO] Final Memory: 15M/79M


And the Dao class
Code:
package com.thalasoft.learnintouch.core.dao;

import java.io.Serializable;
import java.util.List;

import com.thalasoft.learnintouch.core.domain.Form;
import com.thalasoft.learnintouch.core.domain.FormItem;

public interface FormItemDao extends GenericDao<FormItem, Serializable> {

   public List<FormItem> findByForm(Form form);
   public List<FormItem> findByFormOrderById(Form form);
   public FormItem findByListOrder(Form form, int listOrder);
   public FormItem findNextByListOrder(Form form, int listOrder);
   public FormItem findPreviousByListOrder(Form form, int listOrder);
   public long countListOrderDuplicates(Form form);

}


Code:
package com.thalasoft.learnintouch.core.dao.hibernate;

import java.io.Serializable;
import java.util.List;

import org.hibernate.Criteria;
import org.hibernate.Query;
import org.hibernate.criterion.Order;
import org.hibernate.criterion.Restrictions;
import org.springframework.transaction.annotation.Transactional;

import com.thalasoft.learnintouch.core.dao.FormItemDao;
import com.thalasoft.learnintouch.core.domain.Form;
import com.thalasoft.learnintouch.core.domain.FormItem;

@Transactional
public class FormItemHibernateDao extends GenericHibernateDao<FormItem, Serializable> implements FormItemDao {

   @SuppressWarnings("unchecked")
   public List<FormItem> findByForm(Form form) {
      Criteria criteria = getSession().createCriteria(FormItem.class);
      criteria.add(Restrictions.eq("form", form)).addOrder(Order.asc("listOrder"));
      return criteria.list();      
   }
   
   @SuppressWarnings("unchecked")
   public List<FormItem> findByFormOrderById(Form form) {
      Criteria criteria = getSession().createCriteria(FormItem.class);
      criteria.add(Restrictions.eq("form", form)).addOrder(Order.asc("id"));
      return criteria.list();      
   }
   
   @Override
   public FormItem findByListOrder(Form form, int listOrder) {
      Criteria criteria = getSession().createCriteria(FormItem.class);
      criteria.add(Restrictions.eq("form", form)).add(Restrictions.eq("listOrder", listOrder)).setMaxResults(1);
      return (FormItem) criteria.uniqueResult();
   }

   @Override
   public FormItem findNextByListOrder(Form form, int listOrder) {
      Criteria criteria = getSession().createCriteria(FormItem.class);
      criteria.add(Restrictions.eq("form", form)).add(Restrictions.gt("listOrder", listOrder)).addOrder(Order.asc("listOrder")).setMaxResults(1);
      return (FormItem) criteria.uniqueResult();
   }

   @Override
   public FormItem findPreviousByListOrder(Form form, int listOrder) {
      Criteria criteria = getSession().createCriteria(FormItem.class);
      criteria.add(Restrictions.eq("form", form)).add(Restrictions.lt("listOrder", listOrder)).addOrder(Order.desc("listOrder")).setMaxResults(1);
      return (FormItem) criteria.uniqueResult();
   }

   @Override
   public long countListOrderDuplicates(Form form) {
      long itemCount = 0;
      try {
         Query query = getSession().createQuery("select count(fi1.id) as count from FormItem fi1, FormItem fi2 where fi1.id != fi2.id and fi1.listOrder = fi2.listOrder and fi1.form.id = ?");
          query.setLong(0, form.getId());
         Long count = (Long) query.list().get(0);
         itemCount = count.longValue();
      } catch (Exception e) {
           itemCount = 0;
      }
      return itemCount;
   }

}


Code:
package com.thalasoft.learnintouch.core.dao;

import java.io.Serializable;
import java.util.List;

import org.hibernate.Criteria;
import org.hibernate.Session;
import org.hibernate.criterion.Criterion;

public interface GenericDao<T, ID extends Serializable> {

   T makePersistent(T entity);
   
   void makeTransient(T entity);
   
    T findById(ID id, boolean lock);

    boolean isFoundById(ID id);

    List<T> findAll();

    long countAllRows();

    long countFoundRows();

    List<T> findByExample(T exampleInstance, String... excludeProperty);

    List<T> findObjectsByCriteria(Criterion... criterion);
   
    T findObjectByCriteria(Criterion... criterion);
   
   T findObjectByCriteria(Criteria criteria);
   
    Session getSession();
   
}


Code:
package com.thalasoft.learnintouch.core.dao.hibernate;

import java.io.Serializable;
import java.lang.reflect.ParameterizedType;
import java.util.List;

import org.apache.log4j.Logger;
import org.hibernate.Criteria;
import org.hibernate.LockMode;
import org.hibernate.ObjectNotFoundException;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.criterion.Criterion;
import org.hibernate.criterion.Example;
import org.hibernate.criterion.Projections;
import org.springframework.transaction.annotation.Transactional;

import com.thalasoft.learnintouch.core.dao.GenericDao;

@Transactional
public abstract class GenericHibernateDao<T, ID extends Serializable> implements GenericDao<T, ID> {

   private static Logger log = Logger.getLogger(GenericHibernateDao.class);

   private Class<T> persistentClass;
   private SessionFactory sessionFactory;

   @SuppressWarnings("unchecked")
   public GenericHibernateDao() {
      this.persistentClass = (Class<T>) ((ParameterizedType) getClass().getGenericSuperclass()).getActualTypeArguments()[0];
   }

   public void setSessionFactory(SessionFactory sessionFactory) {
      this.sessionFactory = sessionFactory;
   }

   public SessionFactory getSessionFactory() {
      if (sessionFactory == null) {
         throw new IllegalStateException("sessionFactory has not been set on DAO before usage");
      }
      return sessionFactory;
   }

   public Class<T> getPersistentClass() {
      return persistentClass;
   }
   
   @Override
   public Session getSession() {
      return getSessionFactory().getCurrentSession();
   }

   @SuppressWarnings("unchecked")
   @Override
   public T findById(ID id, boolean lock) {
      T entity;
      if (lock)
         entity = (T) getSession().load(getPersistentClass(), id, LockMode.UPGRADE);
      else
         entity = (T) getSession().load(getPersistentClass(), id);

      return entity;
   }

   @SuppressWarnings("unchecked")
   @Override
   public boolean isFoundById(ID id) {
      try {
         @SuppressWarnings("unused")
         T entity = (T) getSession().load(getPersistentClass(), id);
      } catch (ObjectNotFoundException e) {
         return false;
      }

      return true;
   }

   @Override
   public List<T> findAll() {
      return findObjectsByCriteria();
   }

   @Override
   public long countAllRows() {
      Criteria criteria = getSession().createCriteria(getPersistentClass());
      criteria.setProjection(Projections.rowCount());
      // TODO why I cant have a Long here ?
      Integer count = (Integer) criteria.list().get(0);
      long itemCount = count.intValue();
      return itemCount;
   }

   @Override
   public long countFoundRows() {
      Criteria criteria = getSession().createCriteria(getPersistentClass());
      criteria.setProjection(Projections.rowCount());
      // TODO why I cant have a Long here ?
      Integer count = (Integer) criteria.uniqueResult();
       long itemCount = count.intValue();
      return itemCount;
   }

   @SuppressWarnings("unchecked")
   @Override
   public List<T> findByExample(T exampleInstance, String... excludeProperty) {
      Criteria criteria = getSession().createCriteria(getPersistentClass());
      Example example = Example.create(exampleInstance);
      for (String exclude : excludeProperty) {
         example.excludeProperty(exclude);
      }
      criteria.add(example);
      return criteria.list();
   }

   @Override
   public T makePersistent(T entity) {
      getSession().saveOrUpdate(entity);
      return entity;
   }

   @Override
   public void makeTransient(T entity) {
      getSession().delete(entity);
   }

   public void flush() {
      getSession().flush();
   }

   public void clear() {
      getSession().clear();
   }

   @SuppressWarnings("unchecked")
   @Override
   public List<T> findObjectsByCriteria(Criterion... criterion) {
      Criteria criteria = getSession().createCriteria(getPersistentClass());
      for (Criterion c : criterion) {
         criteria.add(c);
      }
      return criteria.list();
   }

   @Override
   public T findObjectByCriteria(Criterion... criterion) {
      T object = null;
      List<T> results = findObjectsByCriteria(criterion);

      if (results.isEmpty()) {
         if (log.isDebugEnabled()) {
            log.debug("No search results found for: " + criterion);
         }
      } else {
         if (results.size() > 1) {
            if (log.isDebugEnabled()) {
               log.debug("The criterion : " + criterion + " should return only one result");
            }
         }
         object = results.get(0);
      }

      return object;
   }

   @SuppressWarnings("unchecked")
   @Override
   public T findObjectByCriteria(Criteria criteria) {
      T object = null;
      List<T> results = criteria.list();

      if (results.isEmpty()) {
         if (log.isDebugEnabled()) {
            log.debug("No search results found for the criteria : " + criteria);
         }
      } else {
         if (results.size() > 1) {
            if (log.isDebugEnabled()) {
               log.debug("The criteria : " + criteria + " should return only one result");
            }
         }
         object = results.get(0);
      }

      return object;
   }

}


Top
 Profile  
 
 Post subject: Re: Persisting and retrieving a collection property
PostPosted: Wed Jul 21, 2010 11:23 am 
Beginner
Beginner

Joined: Tue Jun 30, 2009 7:05 am
Posts: 29
Location: Italy
I'm quite sure the saveOrUpdate method does not return a fully-populated instance of the object saved.
I usually do like this (I use GUIDs as primary keys)
Code:
public String save(ENTITY entity)
{
   String ret = "";
   if (StringUtils.isValid(entity.getId()))
   {
      session.update(entity);
                ret = entity.getId();
   }
   else
   {
      ret = session.save(entity).toString();
      entity.setId(ret);
   }

   return ret;
}

Honestly, I do not see anything wrong in what you are doing.
My guess is that the ID of your form entity is not correctly set, but I could be wrong.


Top
 Profile  
 
 Post subject: Re: Persisting and retrieving a collection property
PostPosted: Wed Jul 21, 2010 11:47 am 
Pro
Pro

Joined: Mon Apr 16, 2007 8:10 am
Posts: 246
Okay, I will try to look into the saveOrUpdate alternative..

What do you think of my Hibernate mapping ?

Could it be that the issue lies within the mapping ?


Top
 Profile  
 
 Post subject: Re: Persisting and retrieving a collection property
PostPosted: Wed Jul 21, 2010 12:06 pm 
Pro
Pro

Joined: Mon Apr 16, 2007 8:10 am
Posts: 246
Stupid me ! Here is one error I just found :

The dao class instance was missing its @Autowired

Code:
   @Autowired
   protected FormItemDao formItemDao;


Top
 Profile  
 
 Post subject: Re: Persisting and retrieving a collection property
PostPosted: Wed Jul 21, 2010 12:15 pm 
Pro
Pro

Joined: Mon Apr 16, 2007 8:10 am
Posts: 246
And so now I have the following test :
Code:
   @Test
   public void testCollection() {
      formItem0 = new FormItem();
      formItem0.setName("name");
      formItem0.setListOrder(2);
      formItem0.setType("itemtype");
      formItem0.setForm(form0);
      formItem1 = new FormItem();
      formItem1.setName("name");
      formItem1.setListOrder(1);
      formItem1.setType("itemtype");
      formItem1.setForm(form0);
      form0 = formDao.makePersistent(form0);
//      formItem0 = formItemDao.makePersistent(formItem0);
//      formItem1 = formItemDao.makePersistent(formItem1);
      Form retrievedForm = formDao.findById(form0.getId(), false);
      assertEquals(2, retrievedForm.getFormItems().size());
   }


But I still get an assert error:

Quote:
Hibernate:
call identity()
19:10:31,801 INFO TransactionalTestExecutionListener:279 - Rolled back transaction after test execution for test context [[TestContext@1f21056 testClass = FormDaoTest, locations = array<String>['classpath:spring-hibernate.xml', 'classpath:spring-hibernate-dao.xml', 'classpath:spring-data-source.xml'], testInstance = com.thalasoft.learnintouch.core.dao.FormDaoTest@13f5841, testMethod = testCollection@FormDaoTest, testException = java.lang.AssertionError: expected:<2> but was:<0>]]
org.apache.maven.surefire.booter.SurefireExecutionException: org/junit/Assume$AssumptionViolatedException; nested exception is java.lang.NoClassDefFoundError: org/junit/Assume$AssumptionViolatedException
java.lang.NoClassDefFoundError: org/junit/Assume$AssumptionViolatedException
at org.springframework.test.context.junit4.SpringMethodRoadie.runTestMethod(SpringMethodRoadie.java:240)
at org.springframework.test.context.junit4.SpringMethodRoadie$RunBeforesThenTestThenAfters.run(SpringMethodRoadie.java:333)
at org.springframework.test.context.junit4.SpringMethodRoadie.runWithRepetitions(SpringMethodRoadie.java:217)
at org.springframework.test.context.junit4.SpringMethodRoadie.runTest(SpringMethodRoadie.java:197)
at org.springframework.test.context.junit4.SpringMethodRoadie.run(SpringMethodRoadie.java:143)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.invokeTestMethod(SpringJUnit4ClassRunner.java:160)
at org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:61)
at org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:54)
at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:34)
at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:44)
at org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:52)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:97)
at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62)
at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140)
at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:127)
at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:345)
at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1009)
19:10:31,804 INFO GenericApplicationContext:815 - Closing org.springframework.context.support.GenericApplicationContext@79a2e7: display name [org.springframework.context.support.GenericApplicationContext@79a2e7]; startup date [Wed Jul 21 19:10:25 EEST 2010]; root of context hierarchy


The form items seem not to be persisted.

So I tried again your tip to place the persisting of the form at the top of the test:

Code:
   @Test
   public void testCollection() {
      form0 = formDao.makePersistent(form0);
      formItem0 = new FormItem();
      formItem0.setName("name");
      formItem0.setListOrder(2);
      formItem0.setType("itemtype");
      formItem0.setForm(form0);
      formItem1 = new FormItem();
      formItem1.setName("name");
      formItem1.setListOrder(1);
      formItem1.setType("itemtype");
      formItem1.setForm(form0);
//      formItem0 = formItemDao.makePersistent(formItem0);
//      formItem1 = formItemDao.makePersistent(formItem1);
      Form retrievedForm = formDao.findById(form0.getId(), false);
      assertEquals(2, retrievedForm.getFormItems().size());
   }


But it still gives the same assert error.


Top
 Profile  
 
 Post subject: Re: Persisting and retrieving a collection property
PostPosted: Wed Jul 21, 2010 12:24 pm 
Pro
Pro

Joined: Mon Apr 16, 2007 8:10 am
Posts: 246
I tried this:
Code:
   @Test
   public void testCollection() {
      formItem0 = new FormItem();
      formItem0.setName("name");
      formItem0.setListOrder(2);
      formItem0.setType("itemtype");
      formItem0.setForm(form0);
      formItem1 = new FormItem();
      formItem1.setName("name");
      formItem1.setListOrder(1);
      formItem1.setType("itemtype");
      formItem1.setForm(form0);
      form0 = formDao.makePersistent(form0);
      formItem0 = formItemDao.makePersistent(formItem0);
      formItem1 = formItemDao.makePersistent(formItem1);
      Form retrievedForm = formDao.findById(form0.getId(), false);
      assertEquals(2, retrievedForm.getFormItems().size());
   }


with Hibernate sending the following (that look okay to me) sql statements:
Quote:
Hibernate:
insert
into
form
(version, name, id)
values
(?, ?, null)
19:19:09,198 DEBUG IntegerType:133 - binding '0' to parameter: 1
19:19:09,198 DEBUG StringType:133 - binding 'form0' to parameter: 2
Hibernate:
call identity()
Hibernate:
insert
into
form_item
(version, form_id, type, name, list_order, id)
values
(?, ?, ?, ?, ?, null)
19:19:09,199 DEBUG IntegerType:133 - binding '0' to parameter: 1
19:19:09,200 DEBUG IntegerType:133 - binding '6' to parameter: 2
19:19:09,200 DEBUG StringType:133 - binding 'itemtype' to parameter: 3
19:19:09,200 DEBUG StringType:133 - binding 'name' to parameter: 4
19:19:09,201 DEBUG IntegerType:133 - binding '2' to parameter: 5
Hibernate:
call identity()
Hibernate:
insert
into
form_item
(version, form_id, type, name, list_order, id)
values
(?, ?, ?, ?, ?, null)
19:19:09,202 DEBUG IntegerType:133 - binding '0' to parameter: 1
19:19:09,203 DEBUG IntegerType:133 - binding '6' to parameter: 2
19:19:09,203 DEBUG StringType:133 - binding 'itemtype' to parameter: 3
19:19:09,203 DEBUG StringType:133 - binding 'name' to parameter: 4
19:19:09,203 DEBUG IntegerType:133 - binding '1' to parameter: 5
Hibernate:
call identity()
19:19:09,205 INFO TransactionalTestExecutionListener:279 - Rolled back transaction after test execution for test context [[TestContext@164de59 testClass = FormDaoTest, locations = array<String>['classpath:spring-hibernate.xml', 'classpath:spring-hibernate-dao.xml', 'classpath:spring-data-source.xml'], testInstance = com.thalasoft.learnintouch.core.dao.FormDaoTest@98f352, testMethod = testCollection@FormDaoTest, testException = java.lang.AssertionError: expected:<2> but was:<0>]]
org.apache.maven.surefire.booter.SurefireExecutionException: org/junit/Assume$AssumptionViolatedException; nested exception is java.lang.NoClassDefFoundError: org/junit/Assume$AssumptionViolatedException
java.lang.NoClassDefFoundError: org/junit/Assume$AssumptionViolatedException
at org.springframework.test.context.junit4.SpringMethodRoadie.runTestMethod(SpringMethodRoadie.java:240)
at org.springframework.test.context.junit4.SpringMethodRoadie$RunBeforesThenTestThenAfters.run(SpringMethodRoadie.java:333)
at org.springframework.test.context.junit4.SpringMethodRoadie.runWithRepetitions(SpringMethodRoadie.java:217)
at org.springframework.test.context.junit4.SpringMethodRoadie.runTest(SpringMethodRoadie.java:197)
at org.springframework.test.context.junit4.SpringMethodRoadie.run(SpringMethodRoadie.java:143)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.invokeTestMethod(SpringJUnit4ClassRunner.java:160)
at org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:61)
at org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:54)
at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:34)
at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:44)
at org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:52)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:97)
at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62)
at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140)
at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:127)
at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:345)
at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1009)


and this
Code:
   @Test
   public void testCollection() {
      formItem0 = new FormItem();
      formItem0.setName("name");
      formItem0.setListOrder(2);
      formItem0.setType("itemtype");
      formItem0.setForm(form0);
      formItem1 = new FormItem();
      formItem1.setName("name");
      formItem1.setListOrder(1);
      formItem1.setType("itemtype");
      formItem1.setForm(form0);
      formItem0 = formItemDao.makePersistent(formItem0);
      formItem1 = formItemDao.makePersistent(formItem1);
      form0 = formDao.makePersistent(form0);
      Form retrievedForm = formDao.findById(form0.getId(), false);
      assertEquals(2, retrievedForm.getFormItems().size());
   }


with Hibernate sending the following (and apparently the same) sql statements:
Quote:
Hibernate:
insert
into
form
(version, name, id)
values
(?, ?, null)
19:21:48,585 DEBUG IntegerType:133 - binding '0' to parameter: 1
19:21:48,586 DEBUG StringType:133 - binding 'form0' to parameter: 2
Hibernate:
call identity()
Hibernate:
insert
into
form_item
(version, form_id, type, name, list_order, id)
values
(?, ?, ?, ?, ?, null)
19:21:48,587 DEBUG IntegerType:133 - binding '0' to parameter: 1
19:21:48,588 DEBUG IntegerType:133 - binding '6' to parameter: 2
19:21:48,588 DEBUG StringType:133 - binding 'itemtype' to parameter: 3
19:21:48,588 DEBUG StringType:133 - binding 'name' to parameter: 4
19:21:48,588 DEBUG IntegerType:133 - binding '2' to parameter: 5
Hibernate:
call identity()
Hibernate:
insert
into
form_item
(version, form_id, type, name, list_order, id)
values
(?, ?, ?, ?, ?, null)
19:21:48,589 DEBUG IntegerType:133 - binding '0' to parameter: 1
19:21:48,589 DEBUG IntegerType:133 - binding '6' to parameter: 2
19:21:48,590 DEBUG StringType:133 - binding 'itemtype' to parameter: 3
19:21:48,590 DEBUG StringType:133 - binding 'name' to parameter: 4
19:21:48,590 DEBUG IntegerType:133 - binding '1' to parameter: 5
Hibernate:
call identity()
19:21:48,592 INFO TransactionalTestExecutionListener:279 - Rolled back transaction after test execution for test context [[TestContext@10e8647 testClass = FormDaoTest, locations = array<String>['classpath:spring-hibernate.xml', 'classpath:spring-hibernate-dao.xml', 'classpath:spring-data-source.xml'], testInstance = com.thalasoft.learnintouch.core.dao.FormDaoTest@1bb205a, testMethod = testCollection@FormDaoTest, testException = java.lang.AssertionError: expected:<2> but was:<0>]]
org.apache.maven.surefire.booter.SurefireExecutionException: org/junit/Assume$AssumptionViolatedException; nested exception is java.lang.NoClassDefFoundError: org/junit/Assume$AssumptionViolatedException
java.lang.NoClassDefFoundError: org/junit/Assume$AssumptionViolatedException
at org.springframework.test.context.junit4.SpringMethodRoadie.runTestMethod(SpringMethodRoadie.java:240)
at org.springframework.test.context.junit4.SpringMethodRoadie$RunBeforesThenTestThenAfters.run(SpringMethodRoadie.java:333)
at org.springframework.test.context.junit4.SpringMethodRoadie.runWithRepetitions(SpringMethodRoadie.java:217)
at org.springframework.test.context.junit4.SpringMethodRoadie.runTest(SpringMethodRoadie.java:197)
at org.springframework.test.context.junit4.SpringMethodRoadie.run(SpringMethodRoadie.java:143)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.invokeTestMethod(SpringJUnit4ClassRunner.java:160)
at org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:61)
at org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:54)
at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:34)
at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:44)
at org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:52)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:97)
at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62)
at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140)
at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:127)
at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:345)
at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1009)


Top
 Profile  
 
 Post subject: Re: Persisting and retrieving a collection property
PostPosted: Wed Jul 21, 2010 12:28 pm 
Pro
Pro

Joined: Mon Apr 16, 2007 8:10 am
Posts: 246
I then commented out the assert statement
// assertEquals(2, retrievedForm.getFormItems().size());

to see what Hibernate would send.

And it sends this:
Quote:
Hibernate:
call identity()
19:24:24,303 INFO TransactionalTestExecutionListener:279 - Rolled back transaction after test execution for test context [[TestContext@10e8647 testClass = FormDaoTest, locations = array<String>['classpath:spring-hibernate.xml', 'classpath:spring-hibernate-dao.xml', 'classpath:spring-data-source.xml'], testInstance = com.thalasoft.learnintouch.core.dao.FormDaoTest@1517e5e, testMethod = testCollection@FormDaoTest, testException = [null]]]
Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.042 sec
Running com.thalasoft.learnintouch.core.dao.ContainerDaoTest
19:24:24,314 INFO TransactionalTestExecutionListener:259 - Began transaction (1): transaction manager [org.springframework.orm.hibernate3.HibernateTransactionManager@320399]; rollback [true]


Why cannot we see in there any sql statement corresponding to the call:
Form retrievedForm = formDao.findById(form0.getId(), false);

Is it that the object is retrieved from some cache or else, and not from an actual select statement on the database ?


Top
 Profile  
 
 Post subject: Re: Persisting and retrieving a collection property
PostPosted: Thu Jul 22, 2010 4:07 am 
Beginner
Beginner

Joined: Tue Jun 30, 2009 7:05 am
Posts: 29
Location: Italy
Your mapping looks ok to me.

The only relevant error I see is the java.lang.NoClassDefFoundError (java.lang.NoClassDefFoundError: org/junit/Assume$AssumptionViolatedException)
I found this post googling the class: http://forum.springsource.org/showthread.php?t=82995
Have a look, they say there is back-compatibility problem between versions 4.4 and 4.7.
If you can resolve that, maybe you'll get a more exhaustive description of the assertion failure.

If you want Hibernate to print every command issued against the DB, you should set the property show_sql to true. Also set to true the property format_sql for an easier reading.


Top
 Profile  
 
 Post subject: Re: Persisting and retrieving a collection property
PostPosted: Thu Jul 22, 2010 4:19 am 
Pro
Pro

Joined: Mon Apr 16, 2007 8:10 am
Posts: 246
Thanks for the link.

Otherwise, I already had the following setup regarding the Hibernate sql output:
Quote:
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.format_sql">true</prop>


Top
 Profile  
 
 Post subject: Re: Persisting and retrieving a collection property
PostPosted: Thu Jul 22, 2010 4:25 am 
Pro
Pro

Joined: Mon Apr 16, 2007 8:10 am
Posts: 246
I used the JUnit 4.4 and got a different console exception output.

Quote:
Results :

Failed tests:
testCollection(com.thalasoft.learnintouch.core.dao.FormDaoTest)

Tests run: 134, Failures: 1, Errors: 0, Skipped: 0

11:21:26,458 INFO GenericApplicationContext:815 - Closing org.springframework.context.support.GenericApplicationContext@75e4fc: display name [org.springframework.context.support.GenericApplicationContext@75e4fc]; startup date [Thu Jul 22 11:21:15 EEST 2010]; root of context hierarchy
11:21:26,458 INFO DefaultListableBeanFactory:421 - Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@1d2b01b: defining beans [sessionFactory,transactionManager,hibernateTemplate,org.springframework.beans.factory.annotation.RequiredAnnotationBeanPostProcessor#0,addressDao,adminDao,adminModuleDao,adminOptionDao,clientDao,contactDao,contactStatusDao,contactRefererDao,containerDao,contentImportDao,contentImportHistoryDao,documentCategoryDao,documentDao,flashDao,formDao,formItemDao,formItemValueDao,formValidDao,userDao,preferenceDao,webpageDao,webpageDirectoryDao,dataSource,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor]; root of factory hierarchy
11:21:26,461 INFO LocalSessionFactoryBean:246 - Closing Hibernate SessionFactory
11:21:26,461 INFO SessionFactoryImpl:816 - closing


Quote:
-------------------------------------------------------------------------------
Test set: com.thalasoft.learnintouch.core.dao.FormDaoTest
-------------------------------------------------------------------------------
Tests run: 4, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.05 sec <<< FAILURE!
testCollection(com.thalasoft.learnintouch.core.dao.FormDaoTest) Time elapsed: 0.013 sec <<< FAILURE!
java.lang.AssertionError: expected:<2> but was:<0>
at org.junit.Assert.fail(Assert.java:74)
at org.junit.Assert.failNotEquals(Assert.java:448)
at org.junit.Assert.assertEquals(Assert.java:102)
at org.junit.Assert.assertEquals(Assert.java:323)
at org.junit.Assert.assertEquals(Assert.java:319)
at com.thalasoft.learnintouch.core.dao.FormDaoTest.testCollection(FormDaoTest.java:67)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.test.context.junit4.SpringTestMethod.invoke(SpringTestMethod.java:160)
at org.springframework.test.context.junit4.SpringMethodRoadie.runTestMethod(SpringMethodRoadie.java:233)
at org.springframework.test.context.junit4.SpringMethodRoadie$RunBeforesThenTestThenAfters.run(SpringMethodRoadie.java:333)
at org.springframework.test.context.junit4.SpringMethodRoadie.runWithRepetitions(SpringMethodRoadie.java:217)
at org.springframework.test.context.junit4.SpringMethodRoadie.runTest(SpringMethodRoadie.java:197)
at org.springframework.test.context.junit4.SpringMethodRoadie.run(SpringMethodRoadie.java:143)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.invokeTestMethod(SpringJUnit4ClassRunner.java:160)
at org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:51)
at org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:44)
at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:27)
at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:37)
at org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:42)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:97)
at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62)
at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140)
at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:127)
at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:345)
at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1009)


Top
 Profile  
 
 Post subject: Re: Persisting and retrieving a collection property
PostPosted: Thu Jul 22, 2010 4:28 am 
Pro
Pro

Joined: Mon Apr 16, 2007 8:10 am
Posts: 246
When commenting out the assertEquals that triggers the exception, Hibernate still does not show any select sql statement.
Quote:
Hibernate:
call identity()
11:26:05,453 INFO TransactionalTestExecutionListener:279 - Rolled back transaction after test execution for test context [[TestContext@944dbd testClass = FormDaoTest, locations = array<String>['classpath:spring-hibernate.xml', 'classpath:spring-hibernate-dao.xml', 'classpath:spring-data-source.xml'], testInstance = com.thalasoft.learnintouch.core.dao.FormDaoTest@4c94e5, testMethod = testCollection@FormDaoTest, testException = [null]]]
Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.044 sec
Running com.thalasoft.learnintouch.core.dao.ContainerDaoTest
11:26:05,464 INFO TransactionalTestExecutionListener:259 - Began transaction (1): transaction manager [org.springframework.orm.hibernate3.HibernateTransactionManager@1d9e5ad]; rollback [true]


I think Hibernate simply does not issue any select sql statement there.

Why..? I don't know..


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 33 posts ]  Go to page 1, 2, 3  Next

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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.