users@glassfish.java.net

Web Service Deployment error

From: Drinkwater, GJ \(Glen\) <"Drinkwater,>
Date: Mon, 12 Mar 2007 10:32:59 -0000

Hi

I get this error when i try and deploy a web service ejb endpoint that
is returning a collection of entities.

I am using glassfish UR1. It seems be saying that the gettter and
setter methods are not the same type in the entity class, but they are.
These are just simple entities that were auto generated from a table.

Any ideas ???

Web Method:

  @WebMethod
    public ArrayList<Investigation> webMethodTest() {
    return new ArrayList<Investigation>();
}

The error is this:

error: The type of the getter is
java.util.Collection<Investigation> but that of the setter is
java.util.Collection. They have to be the same.
        this problem is related to the following location:
                at
uk.icat3.sessionbeans.search.Instrument.getInvestigationCollection
(Unknown
Source)
                at uk.icat3.sessionbeans.search.Instrument (Unknown
Source)
                at
uk.icat3.sessionbeans.search.Investigation.getInstrument
(Unknown Source)
                at uk.icat3.sessionbeans.search.Investigation (Unknown
Source)
                at
uk.icat3.sessionbeans.search.jaxws.WebMethodTestResponse._return(WebMeth
odTestResponse.java:17)
                at
uk.icat3.sessionbeans.search.jaxws.WebMethodTestResponse(WebMethodTestRe
sponse.java:14)
        this problem is related to the following location:
                at
uk.icat3.sessionbeans.search.Instrument.setInvestigationCollection
(Unknown
Source)
                at uk.icat3.sessionbeans.search.Instrument (Unknown
Source)
                at
uk.icat3.sessionbeans.search.Investigation.getInstrument
(Unknown Source)
                at uk.icat3.sessionbeans.search.Investigation (Unknown
Source)
                at
uk.icat3.sessionbeans.search.jaxws.WebMethodTestResponse._return(WebMeth
odTestResponse.java:17)
                at
uk.icat3.sessionbeans.search.jaxws.WebMethodTestResponse(WebMethodTestRe
sponse.java:14)

Investigation class:

@Entity
@Table(name = "INVESTIGATION")
public class Investigation implements Serializable {
    
    @Id
    @Column(name = "ID", nullable = false)
    private Long id;
    
     @Column(name = "TITLE", nullable = false)
    private String title;
           
    @JoinColumn(name = "INSTRUMENT", referencedColumnName = "NAME")
    @ManyToOne
    private Instrument instrument;
       
    
    /** Creates a new instance of Investigation */
    public Investigation() {
    }
  
    public Investigation(Long id) {
        this.id = id;
    }
        
    public Long getId() {
        return this.id;
    }
      
    public void setId(Long id) {
        this.id = id;
    }
   
    public String getTitle() {
        return this.title;
    }
       public void setTitle(String title) {
        this.title = title;
    }
      
    public Instrument getInstrument() {
        return this.instrument;
    }
      
    public void setInstrument(Instrument instrument) {
        this.instrument = instrument;
    }
}

Instrument class.

@Entity
@Table(name = "INSTRUMENT")
public class Instrument implements Serializable {
    
    @Id
    @Column(name = "NAME", nullable = false)
    private String name;
          
    @OneToMany(mappedBy = "instrument")
    private Collection<Investigation> investigationCollection;
        
    /** Creates a new instance of Instrument */
    public Instrument() {
    }
        
    public Instrument(String name) {
        this.name = name;
    }
        
    public String getName() {
        return this.name;
    }
      
    public void setName(String name) {
        this.name = name;
    }
   
    public Collection<Investigation> getInvestigationCollection() {
        return this.investigationCollection;
    }
    
       public void setInvestigationCollection(Collection<Investigation>
investigationCollection) {
        this.investigationCollection = investigationCollection;
    }
}


Thanks Glen