3
I need to pass the variable value sgEstado
for the other class but I can’t, the value is in the return
when threshing, but I can’t get the value out in the other class.
ArrayList estados;
try {
Session session = InitSessionFactory.getInstance().getCurrentSession();
estados = (ArrayList) session.createCriteria(FilialComplementoTO.class).addOrder(Order.asc("sgEstado")).list();
} catch (Exception e) {
Logger.getLogger(this.getClass().getName()).error(e.getMessage());
throw new IntegrationException(e);
}
return estados;
}
Second code, if the value of sgSstado come out in the "passed" below is great, Grateful.
try {
ctx.get(FilialComplementoTO.FILIAL_COMPLEMENTO_KEY);
//FilialComplementoTO filialComplementoTO = (FilialComplementoTO) ctx.get(FilialComplementoTO.FILIAL_COMPLEMENTO_KEY);
LocalizarLojasCompositeEntity localizarLojasCompositeEntity = new LocalizarLojasCompositeEntity();
localizarLojasCompositeEntity.findEstadosBySgEstado();
System.out.println(localizarLojasCompositeEntity.findEstadosBySgEstado());
System.out.println("passou");
}
The top code is the method
localizarLojasCompositeEntity.findEstadosBySgEstado()
? What happens when you run? Something appears that shouldn’t? If you guarantee thatestados
has a value the only problem is that you are returning aArrayList
, or is a variable with multiple elements. You cannot have aArrayList
as a whole, you would need to print the elements of it (even so it depends on how each element of this array). This is usually done withfor in
.– Maniero
The code is the locationLojasCompositeEntity, it normally executes when executed, it appears the "passed" and I verify that the value of 'states' which is a list is correct, with the data I want, in the other code I do not know how to pull from the list created above only the field "Sgestado", which is the field I wish to do a filtering by customer’s state. I don’t know how to just pull a data from the list built in the end method()
– CRAJ
And what is the content (type) of each element of this
ArrayList
?– Maniero
The answer helped? You can accept it.
– Maniero