Hello,

We are using the Data Transfer Object (DTO) pattern to pass data to our 
clients, rather than passing up the entity beans.  Unfortunately, due to time 
constraints, we may not be able to switch to passing the Entity Beans directly.

We are having a problem dealing with optimistic locking.  We've placed @Version 
fields in the entity beans, and version properties in the DTO objects.  We 
construct the DTO on the server, set its version to equal the entity, and then 
send the DTO to the client.  When the client wishes to save the entity, we find 
the old entity, set the version on the entity to match the DTO, and then flush 
the changes to the database.

After testing, the entity manager is not throwing an optimistic lock exception. 
 The EJB specification states that the optimistic lock exception is only done 
when merging detatched entities.  We then tried to create a new Entity in the 
server, populate the data to match the DTO, and then merge.  This does work 
fine, but if the DTO only contains a subset of the information found in the 
entity, the remaining fields will be nulled.  Is there an easy way to only 
update the fields contained in the DTO, while ignoring the others?

If you use the DTO pattern with JBoss, I'd like to learn how you deal with this 
issue.  Thank you,

Sean

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3956623#3956623

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3956623


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to