Announcement Announcement Module
Collapse
No announcement yet.
Transaction ands threads Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Transaction ands threads

    What I have is a unit test where I am using my DAO's to setup data via hibernate(Thread 1). After which I start the object I am trying to test which runs in a separate thread(Thread 2). In Thread 2 an attempt is made to retrieve the data via the DAO but nothing is being returned.

    I know that the transaction from Thread 1 is still pending and the hibernate Session is thread local and only available to Thread 1, which is why the data when Thread 2 attempts to retrieve it. Running the object in the same thread retrieves the data which confirms there are still pending transactions when using threading.

    My question is how to force the transactions still pending in Thread 1 to commit before I start Thread 2?

  • #2
    Originally posted by demerol View Post
    My question is how to force the transactions still pending in Thread 1 to commit before I start Thread 2?
    Can't you do just that?

    Comment

    Working...
    X