Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

result of the setter methods in EntityBeans

 
Phanindra Nayani
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
In entity beans when a setXXX() is called by client for some persistent field, what will happen? Will it write the change immediatly to the database? Immediatly after the completion of the method, will the bean and the database will have the new value specified in this method? Are they not much different than the business methods of entity beans? Pls let me know.
thanks,
Phani
 
Valentin Crettaz
Gold Digger
Sheriff
Posts: 7610
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is up to the Container provider to decide which techniques it adopts regarding the persistency of the cmp fields.
You can read the Section 10.4.2.1 of the EJB spec 2.0 to discover what the spec really mandates.
For instance, BEA Weblogic Server 7.0 SP2 first stores the value of the CMP field within an attribute of the custom generated class that extends your Entity Bean for quick retrieval. It then registers the bean with the RDBMSPersistenceManager to notify the latter that the bean has changed. The PersistenceManager then obtains a transaction and registers the bean with the EntityManager. The databse is then updated accordingly.
I hope it helps
 
Reid M. Pinchback
Ranch Hand
Posts: 775
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is also important to keep in mind that when the container chooses to write to the database is only one part of the problem. It also has to decide when to do the commit, which can't happen until the end of the transaction. If you set multiple fields on the same instance within a single transaction, theoretically the container could choose to do multiple writes, but only one commit. In practice, you'll often see the field updates handled in a single database write.
 
Phanindra Nayani
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thankyou Both !!!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic