A
Andrea Desole
I want to write my first update method for an EJB using BMP. My
favourite solution would be:
bean.setA();
bean.setB();
bean.update();
The problem is that an update can only be made in the ejbStore method,
which is called at the end of a method configured to be used with a
transaction, in this case bean.update(). But, even if I use a
transaction with update, I will then have a call to ejbLoad when I
start it, which basically means that my new values for A and B will be
overwritten with the old ones. I think there are mainly two possibilities:
1) call update(A,B) instead of setA, setB, update
2) setting a flag in setA and setB. ejbLoad will then check the flag: if
the flag is set the object will not be loaded
personally, I find both solutions not that great. Is it another drawback
of EJBs, or there is a better solution?
I'm seriously considering a change of technology...
favourite solution would be:
bean.setA();
bean.setB();
bean.update();
The problem is that an update can only be made in the ejbStore method,
which is called at the end of a method configured to be used with a
transaction, in this case bean.update(). But, even if I use a
transaction with update, I will then have a call to ejbLoad when I
start it, which basically means that my new values for A and B will be
overwritten with the old ones. I think there are mainly two possibilities:
1) call update(A,B) instead of setA, setB, update
2) setting a flag in setA and setB. ejbLoad will then check the flag: if
the flag is set the object will not be loaded
personally, I find both solutions not that great. Is it another drawback
of EJBs, or there is a better solution?
I'm seriously considering a change of technology...