Win a copy of The Business Blockchain this week in the Cloud forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

database write question?

 
pradeep arum
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
 
Sunil Patil
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
 
Janne Karhu
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic