axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Giggle Giggle <xgig...@seznam.cz>
Subject Sending a Collection of objects (advanced :-))
Date Tue, 14 Feb 2006 13:07:06 GMT
Hi,
after several hours I've solved the probem how to send a java collection over soap ("Wrapper"
pattern):

public class CustomerManager {

    private Set<Customer> customers = new HashSet<Customer>();
    
    public Set<Customer> getCustomers() {
        customers.add(new Customer(21, "Paul"));
        customers.add(new Customer(22, "Peter"));
        
        return customers;
    }

Wrapper:
-------------
public class CustomerManagerWrapperSoapBindingImpl implements test.CustomerManagerWrapper{
    
    protected CustomerManager cm = new CustomerManager();
    
    public test.Customer[] getCustomers() throws java.rmi.RemoteException {
        return (Customer[]) cm.getCustomers().toArray(new Customer[0]);
    }
}

Well, works fine, but only when the Customer class has only "primitive" atributes.
But I want to apply this pattern on Customers which includes another collection (I use Hibernate,
collections means one-to-many mapping for example):

// for example
private Set kids;

Is there any possible way except creating another wrapper (around Customer class)?

Thanks for any comments
Lucas

Mime
View raw message