Skip to main content

Returning Collections in Transfer Object from client

1 reply [Last post]
jordanthompson
Offline
Joined: 2007-11-30
Points: 0

Hi there,
I have a java ee application that uses persistence on the server side and communicates with the client using Transfer Objects. Here is an example:

public class UserTo implements java.io.Serializable {

public UserTo() {
}

public String[] loggers = null;
public String[] permissions = null;
public String[] columnHeadings = null;
public String username;
public String password;
public String customer;
public String actualName;
}

This works fine for transfer data from the server to the client, but if I want to set the loggers, for example, the wsdl does not provide a setter for collections, it seems (I have tried Collection, ArrayList, and now, a simple array.) In each case, the wsd creates getters and setters for the strings, but not the collections. This means I cannot return a TO with updated lists!

What am I missing?

thanks.
Jordan

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
jordanthompson
Offline
Joined: 2007-11-30
Points: 0

Duh... its in the code generated by the wsdl:

* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a set method for the loggers property.
*
*

* For example, to add a new item, do as follows:
*

     *    getLoggers().add(newItem);
     *