users@jersey.java.net

Re: [Jersey] Re: generic _at_PathParam??

From: Felipe Gaścho <fgaucho_at_gmail.com>
Date: Mon, 24 Aug 2009 17:30:05 +0200

> What Felipe really wants is Jersey to resolve a type variable, T say, to the concrete type, String say, declared by an extending class.

exactly.. like in this class:

http://kenai.com/projects/puj/sources/arena/content/arena-http/src/main/java/com/kenai/puj/arena/http/PujGenericResource.java?rev=16

This "generic super-resource" works and I can reuse its methods in my
"sub-resources".. but the problem is shown in the method "select":

        @GET
        @Path("{id}")
        public T select(@PathParam("id") String login) {
                return getFacade().read(genericType, (Object) login);
        }


this "id" means an ID column in the database.. what can be of diverse
types.. (String, Integer, etc)...

Fortunately (by luck I guess) the Entity Manager method "find" works
even when I pass a String param to tables with Integer IDs.. and then
I started to think in composite IDs or other types...