The database is create but the data id-generated,ayambo,toledo not inserted, the database is Postgresql 9.0.3, please?, What i do wrong???
Pdta: I now that hibernatetemplate is unused, but the configuration is ok??(Sorry for my bad english.)
You are using Spring in your unit test and transactions. The default behavior of transactions on test methods is to rollback any changes at the end of the test method. Based on your log at the end, it shows that Hibernate is running the insert and the select. But is your test failing?
Also, in your component-scan, you are excluding classes that are annotated with @Repository??? Or are they getting picked up by your second component-scan?
Also, be know, if you are using a version of Hibernate that is higher than 3.1, then you are gaining nothing by using the HibernateTemplate, and would be better of injecting the SessionFactory into your DAO and using straight Hibernate code.
So your code would then look like
You will still get HibernateExceptions translated to Spring's DataAccessException hierarchy with @Repository and your bean for the
<bean class="org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor" />
Ricardo Llontop wrote:Thanks Mark for reply, the only that I fail is that Junit roolback default true, I change this:
@TransactionConfiguration(transactionManager = "transactionManager", defaultRollback = false).
Yep, so now with that setting all the transactions will commit.