• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Viewing data after Hibernate transaction is committed

 
Bai Shen
Ranch Hand
Posts: 323
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a Hibernate transaction where I'm reading and modifying data. Upon successful completion of this modification, I need to send out some notifications using this data.

Basically, I want to continue to be able to read the data that's stored in memory after it's already been committed to the database. I don't need to change it.

Is there an easy way to do this?
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
...

You have the object, just use it. What's the issue?
 
Bai Shen
Ranch Hand
Posts: 323
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
David Newton wrote:...

You have the object, just use it. What's the issue?


Whenever I was trying to use the object, I was getting a session closed exception.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Define "use": if you're just accessing fields, shouldn't be an issue--but I don't know anything about the object in question, how it's being used, configured, etc.
 
Bai Shen
Ranch Hand
Posts: 323
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I ended up changing the code to just clone the data. So I'm not sure what I was doing previously that was causing the exception.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic