Hi! a trivial question: Does accessing a quering method say myentity.getStatus() would cause the DB trigger(insert/update) to be fired? <snip> myentity = myentityhome.findby(id); myentity.getStatus(); <snip> Regards, Nilesh.
Thanks for response. However, How do I know whether the cache is enabled or it is coming from cache? I am using weblogic 4.5.1. The problem is : we have a servlet. From the servlet, It finds an entity bean based on id. (somehow session has it). checks whether the status of the found bean (record) is "cancel" and throws an "application exception" (kind of validation). However, At the end of this operation, the lastediteddate of the table gets updated to system date. This is due to execution of a trigger which says: on insert/update of table, update last edited date to sysdate. This means, the trigger gets fired. But the code does not do any update ("Set" methods). Thanks in advance for clarifying my doubt. Regards, Nilesh.
Joined: Jan 23, 2002
Sorry, I didn't get (pun intended ) that you were talking about only a get method... I don't know why WebLogic 4.5.1 makes an UPDATE even though you're only querying the entity. You probably have double-checked that the trigger is not executed on SELECTs as well, right? I'd suggest turning to BEA forums/support. [ December 15, 2003: Message edited by: Lasse Koskela ]
Originally posted by Lasse Koskela: I'd suggest turning to BEA forums/support.
If you can find someone with WebLogic 4.5.1 knowledge there ! It's quite an old version. [ December 15, 2003: Message edited by: Jean-Louis Marechaux ]
/ JeanLouis<br /><i>"software development has been, is, and will remain fundamentally hard" (Grady Booch)</i><br /> <br />Take a look at <a href="http://www.epfwiki.net/wikis/openup/" target="_blank" rel="nofollow">Agile OpenUP</a> in the Eclipse community
Originally posted by Nilesh Nadiyana: Does accessing a quering method say myentity.getStatus() would cause the DB trigger(insert/update) to be fired?
Calling the getFoo() method should not cause an update to occur. However, I was seeing this behavior (WebLogic 7.0.1) and found that it was my misunderstanding. I put a call to setModifiedDate() in my base entity bean's ejbStore() method after reading WebLogic's documantation that says that ejbStore() is called if the bean has been modified. That turns out not to be the case, though -- instead ejbStore() is called as a result of the bean being involved in a transaction, whether or not the bean was modified. WebLogic's generated ejbStore() method first calls super.ejbStore(), then it checks to see if the bean has been modified and saves it to the DB if so. Moral: make sure your ejbStore() method doesn't modify the bean or the bean will *always* be modified whenever it is involved in a transaction.