Skip to content

Categories:

Using warp-persist @Transactional

This is not directly related to wicket but I guess that many might be using warp-persist in their project.

I am using @Transactional annotation to mark my methods in the service layer. Everything was working as expected until … until I did something like this:

public class UserService {
  public User createNewUser (String name) {
    ...
    createNewUser(name, defaultPermission);
    ...
  }

  @Transactional
  private User createNewUser (String name, Permission permission) {
    ...
  }
}

The surprise here is that in this case the transaction will never be created! The @Transactional works only on non private methods since private methods can not be intercepted for transaction wrapping.

This is well documented here. A classic case of RTFM :-)

Share and Enjoy:
  • Digg
  • Print this article!
  • del.icio.us
  • Facebook
  • Google
  • E-mail this story to a friend!
  • Slashdot

Posted in general.

0 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

Some HTML is OK

(required)

(required, but never shared)

or, reply to this post via trackback.