RequestFactory and query by example with a Proxy

84 views
Skip to first unread message

Cristian Rinaldi

unread,
Feb 17, 2012, 6:15:12 AM2/17/12
to google-we...@googlegroups.com
I am developing a filter to search for an entity.
The filter creates a proxy for the entity to seek, and then use this proxy with RequestFactory.
The problem is that the entity being validated do not know why.

The request is:
Request <List <EntityBaseProxy>> findByProxy (EntityBaseProxy proxy);

Their counterpart on the server is:
public List <EntityBase> findByProxy (EntityBase proxy) {
   Query query = em.get (). CreateQuery ("from EntityBase and WHERE e.namelike: arg1");
   query.setParameter ("arg1" proxy.getName ());
   List list = query.getResultList <EntityBase> ();
   return list;
}


The error I am getting is as follows:

Caused by: java.lang.RuntimeException: The call failed on the server due to aConstraintViolation atcom.google.web.bindery.requestfactory.shared.Receiver.onFailure (Receiver.java: 44) at com.google.web.bindery . requestfactory.shared.Receiver.onViolation(Receiver.java: 66)
....
....


Thanks!!!

Brandon Donnelson

unread,
Feb 18, 2012, 7:14:28 PM2/18/12
to google-we...@googlegroups.com
Do you have constraints in your entity? @NotNull?

Brandon

Brandon Donnelson

unread,
Feb 18, 2012, 7:17:38 PM2/18/12
to google-we...@googlegroups.com
Do you use a ValueProxy?

like:

@ProxyFor(PeopleJdoFilter.class)

public interface PeopleJdoFilterProxy extends ValueProxy {

 void setSearch(List<String> search);

 List<String> getSearch();

//...

}

Cristian Rinaldi

unread,
Feb 22, 2012, 6:33:44 AM2/22/12
to google-we...@googlegroups.com
Thanks Brandon.

I'm using ValueProxy to send to the server.
Look at the code and the entities (EntityProxy) always validated regardless of the method is called on the server (select or persist).
Perhaps the validation should performed only in methods that require it, not always.

Regards
A.U.S Cristian Rinaldi

Teléfono Móvil: (0342) 155 238 083

www.logikas.com

Lisandro de la Torre 2643 Of 5 - 3000 - Santa Fe

Teléfono Fijo: (0342) 483 5138







2012/2/18 Brandon Donnelson <branfl...@gmail.com>

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/5_o0LibBEOMJ.

To post to this group, send email to google-we...@googlegroups.com.
To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

Reply all
Reply to author
Forward
0 new messages