Hi,
We have a big problem using EJB 2.0 with jboss. We use Updatable Value Object Pattern (currently, Transfer Object Pattern). This means we have individual get and set methods in entity bean's remote interface and also have setData methods to make changes in entity bean's attributes in one remote method call. As you know, this may introduce Stale Value Objects. Before considering using CMP 2.0 we were using CMP 1.1. We had version control attribute that was updated in every set method call of bean class. getData method copied the current value of version control in the Value Object and sent it to the client. When updated Value Object was sent back through setData, the implementation of setData within bean class compared version attribute value with the copy of the bean class and threw appropriate exception if they were not the same.
Using CMP 2.0 we can no longer update version control attribute since all set methods are abstract. We thought we can increment version control within ejbStore but jboss can call it without even any entity bean attribute change (very inpredictable). So, we thought we can use optimistic tag and specify version control attribute within jbosscmp-jdbc, but this doesn' t seem to be the case either.
I have the following questions:
1) When bean developer specifies version control attribute, does jboss update its value?
Yes.
2) If it does, then does jboss compare its value in Value Object Pattern scenario and throw any exception? If it does then what is the exception type?
On synchronization, the version field is added to the WHERE clause of the UPDATE statement. Like UPDATE .... WHERE PK = ? AND VERSION = ?
If failed, TransactionRolledBack exception is thrown.
3) If jboss doesn't compare, is there a way that bean developer can compare to let client know of differences?
The version field can be implicit and explicit. Explicit means it is a real cmp-field that has CMP getter and setter and is declared in ejb-jar.xml. JBoss will update this field as above. And you still can use its getter to check the value.
4) If none of these applies then I would like to hear how this optimistic tag with version-control works so we can try to use jboss with CMP 2.0
Seems to be answered.
5) Is there any other way to do version control check in jboss using CMP 2.0 to avoid stale objects problem (weblogic has similar version control and automatically checks and throws exception if versions do not match).
How does it work in weblogic?
It seems like with CMP 2.0 it is the container's responsibility to provide for this type of solution.
Yes. But this is not defined in the spec.
If jboss doesn't have this then how can we use jboss with CMP 2.0 in production.
I think, you can do it.
Or, because of this, we have to use CMP 1.1 only if we still want to stay on jboss.
I really appreciate the response. Thanks, Misak
This message and any attachments are intended only for the use of the addressee and may contain information that is privileged and confidential. If the reader of the message is not the intended recipient or an authorized representative of the intended recipient, you are hereby notified that any dissemination of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail and delete the message and any attachments from your system.
------------------------------------------------------- This SF.net email is sponsored by: IBM Linux Tutorials. Become an expert in LINUX or just sharpen your skills. Sign up for IBM's Free Linux Tutorials. Learn everything from the bash shell to sys admin. Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click _______________________________________________ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user