NetBeans Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
  

How to retrieve a List<> with all the entities in a database table

 
Post new topic   Reply to topic    NetBeans Forums -> Java EE Users
View previous topic :: View next topic  
Author Message
pepelara



Joined: 29 Nov 2008
Posts: 115

PostPosted: Tue Sep 14, 2010 9:20 pm    Post subject: How to retrieve a List<> with all the entities in a database table Reply with quote

Hi,

This is my code,

public JerseyClient() {
com.sun.jersey.api.client.config.ClientConfig config = new com.sun.jersey.api.client.config.DefaultClientConfig();
client = Client.create(config);
webResource = client.resource(BASE_URI).path("pruebas");
}

this is the constructor of the client. And I get the list of entities as follows,

public List<Prueba> getPruebas() {

List<Prueba> pruebas = new ArrayList<Prueba>();

// 2, get response and headers etc, wrapped in ClientResponse
GenericType<List<Prueba>> genericType = new GenericType<List<Prueba>>() {};
pruebas = webResource.get(genericType);

return pruebas;
}

It is based on the question answered by Paul Sandoz at,

[url=wlmailhtml:{3E7A910B-E20C-43DB-9901-778E159A3DAC}mid://00000034/!x-usc:http://jersey.576304.n2.nabble.com/How-can-I-parse-a-java-util-List-Is-it-supported-by-the-Jersey-client-td2300852.html]http://jersey.576304.n2.nabble.com/How-can-I-parse-a-java-util-List-Is-it-supported-by-the-Jersey-client-td2300852.html[/url]

but my code does not work. I get the following error,
org.apache.jasper.JasperException: com.sun.jersey.api.client.ClientHandlerException: A message body reader for Java type, interface java.util.List, and MIME media type, application/xml, was not found

Any help or suggestion will be appreciated.

Regards,
Jose
Back to top
Display posts from previous:   
Post new topic   Reply to topic    NetBeans Forums -> Java EE Users All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo