• Post Reply Bookmark Topic Watch Topic
  • New Topic

TransactionRequiredException with Spring 4, Eclipselink and JPA  RSS feed

 
Siddarth Cherukumudi
Ranch Hand
Posts: 36
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have searched through all the existing questions before posting this. I am using Spring 4 MVC, Eclipselink and JPA

These are my classes
JPA Configuration class



DAO class




This is the exception which I get continuously TransactionRequiredException



I have searched almost everywhere but could not find solution for my problem

Kindly help me

Siddarth C.S
 
Marco Behler
Author
Ranch Hand
Posts: 93
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why are you using @EnableTransactionManagement with AspectJ "mode"? Could you try:

adviceMode=proxy, proxyTargetClass=true


Other than that, your code looks fine...?




 
Siddarth Cherukumudi
Ranch Hand
Posts: 36
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nothing specific. Even I tried without using the mode as well it does not seem to work, Hence tried with giving it
 
Marco Behler
Author
Ranch Hand
Posts: 93
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was asking, because in your stacktrace, there are no lines regarding a "TransactionProxy", i.e. your class does not get wrapped with a transaction. I wasn't sure if you had aspectj setup correctly and with that compile time weaving, but in any case, that's where i would have a look at.
 
Siddarth Cherukumudi
Ranch Hand
Posts: 36
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Thanks for your time, If you can help me look at the issue. I can share my project with you
please let me know if you are fine with that
 
Marco Behler
Author
Ranch Hand
Posts: 93
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you put the .zipped project somewhere? Or put it on GitHub or something similar? Thanks
 
Siddarth Cherukumudi
Ranch Hand
Posts: 36
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Here is my project My Project
 
Marco Behler
Author
Ranch Hand
Posts: 93
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Siddarth, I just tried your code.

the code sample you sent me had the same problem, the same exception. BUT, you were missing the @Transactional annotations on the BookRepository, which are however in the code you pasted in here.

So with @Transactional AND @EnableTransactionManagement (no special options), it works just fine for me.
 
Siddarth Cherukumudi
Ranch Hand
Posts: 36
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Marco,

Thanks a lot for your time. Unfortunately after doing what you have told me I am still landing into the same issue.

Can you please Post the project which you have modified in GitHub or somewhere, I will take it from there and run it?
 
Marco Behler
Author
Ranch Hand
Posts: 93
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
will upload it tomorrow or the day after
 
Marco Behler
Author
Ranch Hand
Posts: 93
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Siddarth,

check out the following link. It is your project and it should work.

www.marcobehler.com/External.zip
 
Siddarth Cherukumudi
Ranch Hand
Posts: 36
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Marco,

Thanks a ton for the code. After carefully observing found the difference between mine and your code. i.e. wrt WebAppInitializer class

My Code


Your Code



Now I am wondering why this is the case. Can you please shed some light on this please?

Regards,
Siddartha C.S
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!