Rox
Rox

Reputation: 2917

My web service does not return all rows from database even if I specify it to get all rows

I have a web-service where I would like to retreive all Persons belonging to a Group. I have generated all java class files with NetBeans (rightclick project, select "New" and then select "Entity classes from database") and all classes have its corresponding table in the database.

The database schema looks something like this:

Person
 PK person_id: INT
    person_name     : VARCHAR

GroupPerson
 pfK person_id: INT
 pfK group_id: INT

Group
 PK group_id: INT
    group_name     : VARCHAR

The four java classes that were generated are:

I have populated the database with one group and three persons.

In the web service there is a method I have named getGroupAndPersons(int groupId) that returns the group and all related persons based on the group_id. I call the named query called "GroupPerson.findByGroupId" that is declared in GroupPersson and it just does a: SELECT a FROM GroupPerson a WHERE a.groupPersonPK.groupId = :groupId

When I call the method from SOAP in PHP I just get a resultlist containing the selected Group and the first person belonging to the group, never more than one person even if there are many persons belonging to the group.

So my question is why I never get more than one person returned from the webservice even if there are many persons that is related to one group.

Upvotes: 0

Views: 334

Answers (1)

simaremare
simaremare

Reputation: 417

what is the return of your web-service method,.? it should be List, is that what you have,.?

Upvotes: 1

Related Questions