why is the ejbstore() called when i invoke any getter method of my bean ?
Hi All,
I have designed one enterprise bean with three attributes title , type and date.
and i have implemented getter and setter method for these member variables.
When i call any one of getter methods,
the output at server as follows :
getTittle();
ejbStore();
getType();
ejbStore();
......
I want to know why the ejbStore() is called as soon as i called any one of getter methods.
I heard ejbLoad() and ejbStore() are invoked by container based on transaction attribute.
I even set "Never" as transaction attribute . Still i got a same type of output.
Couldyou explain me why it happens ?
Thanks in advance,
nvseenu
[723 byte] By [
nsrininasa] at [2007-11-26 21:52:00]

# 1
Hi
ejbStore is called if any of the three is true:
1. A tx completes and the bean participated in the Tx and atleast one business method was called. Note that getters are also business methods.
2. A Finder method is called within the tx, which causes ejbStore() to be called by the container (before the finder executes)
3. The method is marked using "flush-et-end-of-method" attribute in sun-ejb-jar.xml.
I am surprised that TX_NENVER causes ejbStore(). Can you send us the ejb-jar.xml and sun-ejb-jar.xml?
# 2
Hi magesh ,
> Hi
>ejbStore is called if any of the three is true:
> . A tx completes and the bean participated in the Tx
> and atleast one business method was called. Note that
> getters are also business methods.
> 2. A Finder method is called within the tx, which
> causes ejbStore() to be called by the container
> (before the finder executes)
> 3. The method is marked using
> "flush-et-end-of-method" attribute in
> sun-ejb-jar.xml.
I understood the concepts explained here.
>
> I am surprised that TX_NENVER causes ejbStore(). Can
> you send us the ejb-jar.xml and sun-ejb-jar.xml?
The thing which confuse me is why ejbStore() is called for Transction attribute
"Never".
My ejb-jar.xmlfile is as follows:
<!DOCTYPE ejb-jar PUBLIC
"-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN"
"http://java.sun.com/dtd/ejb-jar_2_0.dtd">
<ejb-jar>
<enterprise-beans>
<entity>
<ejb-name>BarronsEJB</ejb-name>
<home>test.BarronsHome</home>
<remote>test.Barrons</remote>
<ejb-class>test.BarronsBean</ejb-class>
<persistence-type>Bean</persistence-type>
<prim-key-class>test.BarronsPK</prim-key-class>
<reentrant>false</reentrant>
<resource-ref>
<res-ref-name>jdbc/MySqlDS</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
</entity>
</enterprise-beans>
<assembly-descriptor>
<container-transaction>
<method>
<ejb-name>BarronsEJB</ejb-name>
<method-intf>Remote</method-intf>
<method-name>*</method-name>
</method>
<trans-attribute>Never</trans-attribute>
</container-transaction>
</assembly-descriptor>
</ejb-jar>
BarronsBean has three member variables " id , title , type " and gettter and setter methods for these variables.
I use JBoss App Server to run EJB.
I feel information i have given here may be enough to you to explain me why ejbStore() is called after any one of the getter / setter method is invoked.
Thanks in advance,
nvseenu