• 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

database write question?

 
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
excuse me if this is a silly question...

when actually is the write to the database done ?
is it after the postEJBCreate() with all those setters methods() ...the client would not start any transaction in this case...so no commit
when is the write done if the client starts a transaction and then commits?
this question should not arise if i write any piece of code.......
thanks
pradeep
 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Pradeep,
In case of Entity bean it will be Container managed transaction so there wont be case of client starting transaction
Database write will be done once ejbCreate() is executed and before ejbPostCreate() because in ejbPostCreate() you will be able to take care of ejb-relationships(This you can not do unless there is record in parent table) and you need to have primary key set before your ejbCreate() method execution completes.
Hope this helps
Sunil
 
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To my best knowledge, the data is written to the database right after ejbCreate() callback by the container. Databases can have committed or uncommitted data, so the committion time does not really affect the database writing process.
Use search engine (Google etc.) to find more information about database isolation levels (READ_COMMITTED etc.).
 
pradeep arum
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Sunil..it helped a lot
 
Eat that pie! EAT IT! Now read this tiny ad. READ IT!
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic