Sunday, May 11, 2014

Re: error beanproxy can't Content other beanproxy

Hola Ignacio, gracias por la respuesta, pero sigo teniendo problemas con los beanproxy anidados.
El problema es el siguiente un prestamo pertenece a un cliente entonces el bean cliente esta contenido dentro del bean prestamo, al llevar el listado de prestamos con la opcion with como mencionas este lo lleva a veces bajo ciertos parametros.
Coloco ambos metodos, tanto de cliente y servidor:

Metodo en el cliente:

@Override
public void cargarTabla() {
lista = new ArrayList<PrestamoProxy>();
FACTORY.initialize(EVENTBUS);
ContextGestionPrestamo context = FACTORY.contextGestionPrestamo();
Request<List<PrestamoProxy>> request = context.listarPrestamoByUsuario(UIHome.usuario.getIdUsuario(), "P").with("beanCliente");
//Request<List<PrestamoProxy>> request = context.listarPrestamo();
request.fire(new Receiver<List<PrestamoProxy>>() {
@Override
public void onSuccess(List<PrestamoProxy> response) {
// TODO Auto-generated method stub
/*Iterator<PrestamoProxy> i=response.iterator(); 
 while(i.hasNext()){
 PrestamoProxy c=i.next(); 
 com.google.gwt.user.client.Window.alert(c.getBeanCliente().getNombre()+c.getBeanCliente().getApellido()); }*/
lista = response;
grid.setData(lista);
grid.getSelectionModel().clear();
double alto=lista.size()*45;
container.setHeight(alto+"px");
scrollPanel.refresh();
}
});
}

Metodo en el servidor:

public static List<Prestamo> listarPrestamoByUsuario(String idUsuario,
String estado) throws UnknownException {

PersistenceManager pm = null;
try {
pm = PMF.getPMF().getPersistenceManager();
LogicPrestamo logic = new LogicPrestamo(pm);
List<Prestamo> resultado = (List<Prestamo>) logic
.getListarBeanByUsuario(idUsuario, estado);
 Iterator<Prestamo> i=resultado.iterator(); 
 while(i.hasNext()){
 Prestamo c=i.next(); 
 System.out.println(c.getBeanCliente().getDni()); 
 System.out.println(c.getBeanCliente().getNombre());
 System.out.println(c.getBeanCliente().getApellido());
 }
pm.close();
return resultado;
} catch (Exception ex) {
LOG.warning(ex.getMessage());
LOG.info(ex.getLocalizedMessage());
throw new UnknownException(ex.getMessage());
} finally {
if (!pm.isClosed()) {
pm.close();
}
}

}

lo mas raro es que funciona cuando hago el recorrido de la lista de prestamos e imprimo en consola los clientes de cada prestamo.

Trabajo con GWT 2.5.1 y Google App Engine 1.8.3

El sábado, 3 de mayo de 2014 05:00:36 UTC-5, Ignacio Baca Moreno-Torres escribió:
a q librería te refieres con beanproxy?

Si te refieres a los ValueProxy/EntityProxy de request factory, para que la respuesta incluya los EntityProxy anidados debes incluirlos en el 'with' del Request.
Más info aquí http://www.gwtproject.org/doc/latest/DevGuideRequestFactory.html#relationships

On Saturday, May 3, 2014 12:19:08 AM UTC+2, Jonathan Franchesco Torres Bca wrote:
Hi,i can to send a beanproxy in beanproxy from frontend to backend, but of backend to frontend i can't to send a beanproxy in of other beanproxy.

In spanish.
Hola, yo tengo una duda, yo puedo enviar un beanproxy con otro beanproxy dentro de este desde el cliente al servidor y funciona genial, pero cuando es a la inversa a traves de requesta factory enviar un bean dentro de otro bean desde el servidor al cliente no funciona, el envio es a traves de requestfactory...
Creo que aun no han implementado eso, ya que a nivel de servidor el bean si esta dentro del otro bean y ambos tienen su beanproxy espejo, espero respondan a mi duda, claro en ingles lo podre leer

--
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 google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment