Hi everyone,

I have been using GWT-RequestFactory and I have to admit that it pretty 
much ease and speed up the development but also some times I feel a bit 
more control and flexibility required to be given out of the *API* to 
developer. 

In short my problem here is : I am not able to send an entity proxy to 
server with an id and null version because I get something like this 

*The persisted entity with id '1' has null version'*

Here is detailed explanation by example

1)Consider Entity  : Employee (id, name, age, address, city country, 
gender).
2)Consider a search by keywords page where we have textboxes for
         i) Employee ID 
        II) Name 
       iii) City
       iv) Country
        v) gender
3) User chooses any number of above fields, types things and hit enter. 
     eg. Name : thom   ---  hit on search
4) A Celltable or Grid appears as results of search 
     eg. list of all employees whose name like '%thom%', -> Thomas, Thor etc
  
Hope that explains the feature. So here I am sending the keywords to sever 
wrapped in a bean proxy itself. for example when user hits 'Search' button 
: ->
     req = reqFactory.getEmployeeRequest();
     EmployeeProxy emp = req.create(EmployeeProxy.class);
     emp.setId(idTextBox.getValue()); //getting entered (or null) value in 
text box
     emp.setName(nameTextBox.getValue());
     //......
     req.searchEmployeeByKey(emp).fire(new Receiver<List<EmployeeProxy>> () 
{

             public void onSuccess(<List<EmployeeProxy>> list) {........}


      });

Here I am using a entity proxy just for search purpose. But if the '*id' 
*entity 
is populate ( consider user knows employee id and enters it in respective 
text box and hit search) like 
   emp.setId(idTextBox.getValue()) // it not null this time!!! say id is '*
1'*

RequestFactory complains *'The persisted entity with id '1' has null 
version'

*So I tried to find a workaround by setting version to *'0' *or any number. 
But in my EmployeeLocator I have this :
   
   @Override
    public Employee find(Class<? extends Employee> clazz, final Integer id) 
{
        return employeeDao.findById(id);// *Assume version is 21*. *bam!!  
0 != 21 --> Autobean frozen!!!!!  *
    } 

Which will return latest entity from database having the latest version. 
Now if its now *'0' *, I mean if it does not match with the arbitrary 
version set on client,  the RequestFactory will again throw exception 
complaining :
      *The AutoBean has been frozen.

*
*
--------------x-----------------------------------------------------------x-----------------------------------------------x----------------------------------x
*
*
*Is there any way I can tell RequestFactory: 
    '*Hey RequestFactory, chill !!!, don't make any checks and don't throw 
any exception, this one is just for search purpose*'


Thanks in advance. 

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to