This forum is now a read-only archive. All commenting, posting, registration services have been turned off. Those needing community support and/or wanting to ask questions should refer to the Tag/Forum map, and to http://spring.io/questions for a curated list of stackoverflow tags that Pivotal engineers, and the community, monitor.

Spring + JPA not committing data

Aug 23rd, 2006, 08:15 PM

I have a very simple annotated POJO. I'm using toplink-essentials. Unit tests succeed in inserting/deleting/updating. The problem I have is when I use the code from the web tier. Reading data is fine. Inserting or updating does nothing. No errors. From the log, I can see the EntityManager being created then immediately closed. The same behaviour occurs with MySQL 5.0.24 and PostgreSQL 8.14.

I am missing the place, where you create a transactional proxy around your service. Without using a transactional proxy no commit will be performed. Have a look at the reference manual for more information.

I'm calling net.vitarara.quadran.core.business.impl.party.Part yManagerImpl.createEntity (), which I believe should be wrapped in a transaction. The PartyManager.createEntity() method is delegating the actual work to a processor object in the same package that is being done in it's execute() method, which I also believe should be wrapped in the transaction. The execute() method then calls the Dao object's persist method using getJpaTemplate().

What am I missing here?

Note I have tried this with both the Jpa and Jta transaction managers.

Comment

Guess what... rejected means precisely that - no transaction management for this call
I would try playing with pointcut definition 'execute bla-bla' string till I'd get 'accepted' in log. That means you're onboard.

Try to catch not Impl class but her interface per se. I am catching interface * *..Service.*(*..Cat)

Comment

Guess what... rejected means precisely that - no transaction management for this call
I would try playing with pointcut definition 'execute bla-bla' string till I'd get 'accepted' in log. That means you're onboard.

Try to catch not Impl class but her interface per se. I am catching interface * *..Service.*(*..Cat)

OK, I cast the net wider like you said to do.

Now I see the aspect being accepted for my interface. I have the following in the logs after turning on logging for org.springframework.

One too many. Sorry,cannot help you with this one. With JBoss I do JBoss and JPA part or the application is made using JBoss facilites, i.e.no Spring JPA template. I might try this template (though do not feel much practicality in doing this in JBoss environment) but definitely it is not my my plate right now.

Comment

Yes, I finally tracked down that typo, but it wasn't the end of the issue. (I sure did kick myself over that typo though.) I'm in the process of doing a writeup on it, but I've also posted about it on my Blog, linked to earlier.