users@jersey.java.net

Re: [Jersey] NetBeans6.5 and Jersey

From: Peter Liu <Peter.Liu_at_Sun.COM>
Date: Mon, 01 Dec 2008 16:49:03 -0800

On Dec 1, 2008, at 8:35 AM, Paul Sandoz wrote:

> Hi Vijay,
>
> On Dec 1, 2008, at 1:00 PM, Kumar, Vijay wrote:
>
>> Hi,
>>
>> I am using the NetBeans 6.5 RC2 and generated the Restful web
>> services code for my MSSQL 2000 database.
>>
>> When I tried to get the records from one table then I got 20
>> records but my default value for @QueryParam("max") is set to 10
>> only.
>> In that case I supposed to get only 10 records but I am getting 10
>> records 2 times so total 20 records.
>> I don’t know this is the problem with NetBeans generated code or
>> Jersey.
>
> My suspicion is Jersey is not turning 10 into 20.
>
> It could be with the generated code. Do you get 20 unique records
> back or is each record duplicated?
>
> Did you verify that the URL does not contain a max=20 query
> parameter :-)
>
>
>>
>> How do I enable logging for Jersey as I want to see what Jersey is
>> doing for me.
>
> There is not much direct logging support in Jersey. You can log the
> request/response using a filter (if you want that i can point you to
> how to do that).
>
> I recommend you set a debug point in the application- generated code
> that implements the HTTP method and supports the query parameters
> and check the value of the query parameter.

You should also check to see how many records are in the result list
returned by the JPA query.
This could also be an issue between the JPA provider (I am assuming
you are using TopLink)
and SQL Server.

>
>
>> In fact I am interested to see what database queries Jersey is
>> executing.
>
> This i do not know, anything in MSSQL 2000 for that? otherwise i
> dunno if there is some logging stuff in the JDBC layer, or that NBs
> offers something.
>
>

Assuming you are using TopLink, you can specify the
toplink.logging.level in the persistence.xml.
The following link shows you how to do that:

http://www.oracle.com/technology/products/ias/toplink/jpa/howto/configure-logging.html''


>>
>> If I want to make a join between 2 tables as I want to pickup few
>> columns from two tables based on common
>> columns then what is the way to do this?
>
> I do not know :-( you may have to write your own code for this. I
> have forwarded the email to a NetBeans developer who may have some
> more advice.

NB generates RESTful web services from a set of JPA classes.
Unfortunately, NB currently does not
support generating entity classes from joining tables together.
Perhaps you can try creating a view from
the tables and then create the entity class from the view.



>
> Paul.