I understand that a similar question was asked before, but I could not find a solution to my problem. Basically, I'm trying to use JPA through Hibernate in Spring, but for some reason the data is not being saved. Disabling debugging during a spring transaction does not detect anything - the EntityManager is open and closed, but nothing is visible, as far as the transaction manager is concerned ... I'm sure I miss something big, any help is appreciated! See below for more details.
TIA
Oliver
The basic layout is as follows: class FooDaoJPA s save function calls entityManager.persist(object) to save the object.
class FooServiceImpl implements the service interface:
@Transactional(rollbackFor = DataAccessException.class, readOnly = false, timeout = 30, propagation = Propagation.SUPPORTS, isolation = Isolation.DEFAULT) public void saveFoo(Foo foo) throws DataAccessException { fooDao.save(foo); }
It is noted that fooDao is introduced by spring IoC
Finally, the controller is introduced by a FooService and calls saveFoo() to save the data.
JPA configuration
<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean" p:dataSource-ref="feDataSource"/> <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager" p:entityManagerFactory-ref="entityManagerFactory"/> <tx:annotation-driven mode="aspectj" transaction-manager="transactionManager"/>
spring
Oliver
source share