Friday, September 17, 2010

Spring Exception:delaying identity-insert due to no transaction in progress

I kicked off a new project by copying the code generated from Spring Roo and it worked pretty well at beginning. However, when I begin the web layer (Spring MVC Controller), strange things happen.

The problem is, the Controller cannot use Service layer to persist data into database. But the Unit Test does not have this problem. I turn on debug and check the log file carefully. In the place where data should inert into database, I find the information: "delaying identity-insert due to no transaction in progress".

Spring Roo use AspectJ to manage transcation and it requires some job in compiling time. So we need to add aspectj-maven-plugin to build this project.


    org.codehaus.mojo
    aspectj-maven-plugin
    1.3
    
     
      org.aspectj
      aspectjrt
      ${aspectj.version}
     
     
      org.aspectj
      aspectjtools
      ${aspectj.version}
     
    
    
     
      
       compile
       test-compile
      
     
    
    
     true
     
      
       org.springframework
       spring-aspects
      
     
     1.6
     1.6
    
   

3 comments:

Guido said...
This comment has been removed by the author.
Guido said...
This comment has been removed by the author.
Guido said...

How did you finally solve this issue? Thanks