Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

about transaction and entity detachment

 
Ranch Foreman
Posts: 1897
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In chapter 6 ,



The findAll() method of the EmployeeService bean has no transaction.Because the serlvet invoking the method has not started a transaction, findAll() is invoked in a no transaction context, thus the results of the query become detached before they are returned to the servlet.



I think by default the CDI bean EmployeeService has container managed transaction and the findAll () has transaction attribute= required by default.
I believe the findAll() method finishes a transaction and the employees entities returned from the query become detached because the transaction commits.
 
Creator of Enthuware JWS+ V6
Posts: 3341
303
Android Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I think by default the CDI bean EmployeeService has container managed transaction


No, in Java EE6, CDI beans do not have transaction management (in EE7, they do).
 
Trust God, but always tether your camel... to this tiny ad.
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic