Note that there are some explanatory texts on larger screens.

plurals
  1. POObject sent from client to web-service using WSDL is null on the web-service, but not in the client, why?
    primarykey
    data
    text
    <p>I have a web service running EclipseLink. I have generated some Java classes with NetBeans that are based on the database schema ("Entity classes from database...").</p> <p>My problem is about two classes called Person.java and Group.java that have been generated by NetBeans based on the database schema. Person.java and Group.java is part of the JAR file "MyLib.jar"</p> <p>In Group.java, I have this code (among other code):</p> <pre><code>@Column(name = "groupName") private String groupName; @OneToMany(cascade = CascadeType.ALL, mappedBy = "group") private Collection&lt;Person&gt; personCollection; public String setGroupName(String groupName) { this.groupName = groupName; } public String getGroupName(){ return groupName; } @XmlTransient public Collection&lt;Person&gt; getPersonCollection() { return personCollection; } public void setPersonCollection(Collection&lt;Person&gt; personCollection) { this.personCollection = personCollection; } </code></pre> <p>I have two different applications that include the "MyLib.jar". One is the web-service itself and the other is a client that connects to the web-service. The client also, of course, includes the web service interface JAR.</p> <p>In the client I create a collection of Persons like this and then send the group instance to the web-service:</p> <pre><code>Collection&lt;Person&gt; persons = new ArrayList&lt;Person&gt;(); Person person = new Person(); person.setName("Peter"); persons.add(person); group.setName("GroupName"); group.setPersonCollection(persons); System.out.print(persons); // prints the instance and its content webserviceInstance.setGroup(group); </code></pre> <p>The really strange thing is that in the web-service method <code>setGroup</code>, the collection is null! </p> <pre><code>@Override public void setGroup(Group group) { System.out.print(group.getGroupName()); // prints "GroupName" System.out.print(group.getPersonCollection()); // prints null meaning the instance is null ... } </code></pre> <p>I simply cannot understand why the collection is null in the web service but not in the client. Am I doing anything wrong?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload