• 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
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

about transaction and entity detachment

 
Ranch Hand
Posts: 1738
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: 3285
296
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).
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!