• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Question on Transaction Management

 
Joe Harry
Ranch Hand
Posts: 10128
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Guys,

I would like to acheive something like this,

In my bean class,



Does using Required will solve my purpose?

 
Hong Anderson
Ranch Hand
Posts: 1936
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is your purpose?
 
Joe Harry
Ranch Hand
Posts: 10128
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I simply want to get the userId for a user that gets created by calling method 1.
 
Hong Anderson
Ranch Hand
Posts: 1936
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, can you just declare method2 to accept a parameter, and write method1 to pass a parameter to method2?
 
kiran mathew
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
After saving the user in method1, you are trying to retrieve the details in method2. Since method1 transaction is not committed, you will not be able to read the non-committed data from method2.

If possible go for the solution suggested above, else you can try the following.
1) Restructure the code, so that method2 is invoked from outside method1.
2) Change the transaction mode of database connection in method2 to get non-committed data.
3) If you are using hibernate then you can try a session.flush
 
Joe Harry
Ranch Hand
Posts: 10128
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I did something like this,
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic