Announcement Announcement Module
No announcement yet.
Testing detatched behavior Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Testing detatched behavior

    I'm trying to write integration tests using AbstractTransactionalDataSourceSpringContextTests, and one behavior I want to test is the web tier modifying a detached object and passing it into the middle tier for saving.

    Unfortunately, I cannot find any way to detatch an object safely. If I call endTransaction(), I get lazy-load errors on the now-detached object (on it's fields and calling toString()). I suspect killing the transaction messes up the load somehow.

    Evict() doesn't seem to work, as the object still acts attached.

    Is there any way to start a sub-transaction inside a test to force an object to load in a different session than the one it's saved in?