This week's book giveaway is in the Features new in Java 9 forum.
We're giving away four copies of Java 9 Revealed and have Kishori Sharan on-line!
See this thread for details.
Win a copy of Java 9 Revealed this week in the Features new in Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to use session.get and getCurrentSession in same transaction  RSS feed

 
strutsBie hote
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using getCurrentSession in hibernate with which i am saving a object1.I do not commit the save
Now while saving another object2 i also need object1.

Earlier while with openSession i used to to call

session.get(Sample.class, SampleIdOfObject1)

But now i can't use this method because there is no object with it's id as SampleIdOfObject1.

I dont want to use Sessions.

 
varun Dosapati
Ranch Hand
Posts: 31
Java Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can you provide more information.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!