Using RequestFactory I gets data to View, then in other transaction
someone else updating this object to version 1 (My view has still
version 0). Next I update some values and push changes by
RequestFactory to DAO Layer. The problem is when changed object is
transferted to Service Layer: the Locator calls find method and gets
newest version of object (changed by someone else). So when we gets to
update method in DAO layer object is merged with version1 and changes
from both transaction! In this situation in normal case Hibernate
should throw exception because object should has other version value
(Optimistic Lock)?

Locator:

@Component
public class TaskItemLocator extends Locator<TaskItem, Long> {
   @Autowired
   private TaskItemDao taskItemDao;

   @Override
   public TaskItem find(Class<? extends TaskItem> aClass, Long id) {
     return taskItemDao.findTaskItem(id);
   }
}
DAO:

@Override
@Transactional(propagation = Propagation.REQUIRED)
public void updateTaskItems(List<TaskItem> taskItemToUpdate) {
        for (TaskItem ti : taskItemToUpdate) {
            getHibernateTemplate().update(ti);
        }
}
When I simulate this situation without calling find in RequestFactory
everything works ok. The exception is thrown when other transaction
changes my object. But how to gets this behavior in RequestFactory?
Besides befor every update RequestFactory call find method so select
to DB is performed. Next go to DAO layer and hibernate calls exacly
the same select query because he checks object version. So one select
is duplicated unnecessery, for every updated object!!!

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to