• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

TransactionRequiredException with Spring 4, Eclipselink and JPA

 
Ranch Hand
Posts: 37
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Author
Posts: 141
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 37
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 141
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 37
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 141
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 37
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Here is my project My Project
 
Marco Behler
Author
Posts: 141
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 37
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 141
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
will upload it tomorrow or the day after
 
Marco Behler
Author
Posts: 141
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 37
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Siddarth Cherukumudi
Ranch Hand
Posts: 37
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Marco,

Gentle remainder, awaiting reply for above post

reply
    Bookmark Topic Watch Topic
  • New Topic