2 Replies Latest reply: Oct 11, 2012 3:29 PM by 960839 RSS

    wsimport tool aretfacts with missing fields

    960839
      I'm writing a desktop client for simple soap service (axis), and when i create a web-service client lib using netbeans wsimport tool, i dont understand why for that entity :
      import javax.persistence.*;
      import javax.persistence.Entity;
      import javax.persistence.Table;
      import javax.persistence.UniqueConstraint;
      import javax.validation.constraints.NotNull;
      
      import org.hibernate.cfg.*;
      
      @Entity
      @Table(name = "USERS_OUTLAYS"/*, uniqueConstraints = {
          @UniqueConstraint(columnNames = {"USER_OUTLAY_ID"})}*/)
      public class UserOutlay {
      
          @Id
          @GeneratedValue(strategy = GenerationType.AUTO)
          @Column(name = "USER_OUTLAY_ID", nullable = false)
          private long id;
          @Column(name = "PRODUCTS_AMOUNT", nullable = false)
          private int products_count;
          @Column(name = "USER_OUTLAY_DATETIME", nullable = false)
          private String datetime;
          @OneToOne()
          @NotNull
          //@Column(name="USER")
          private User user;
          @OneToOne()
          @NotNull
          //@Column(name="PRODUCT")
          private Product product;
          
          @Column(name = "OVERRAL_OUTLAY")
          @NotNull
          private double overral;
      
          public double getOverral() {
              return overral;
          }
      
          public void setOverral() {
              this.overral = product.getCost() * this.products_count;
          }
      
          public void setProducts_count(int products_count) {
              this.products_count = products_count;
          }
      
          public void setDatetime(String datetime) {
              this.datetime = datetime;
          }
      
          public void setProduct(Product product) {
              this.product = product;
          }
      
          public void setUser(User user) {
              this.user = user;
          }
      
          public int getProducts_count() {
              return products_count;
          }
      
          public String getDatetime() {
              return datetime;
          }
      
          public long getId() {
              return id;
          }
      
          public Product getProduct() {
              return product;
          }
      
          public User getUser() {
              return user;
          }
      
          @Override
          public String toString() {
              return "UserOutlay {" + "id=" + id + ", amount=" + products_count + ", datetime=" + datetime + ", user=" + Long.toString(user.getId()) + ", product=" + Long.toString(product.getId()) + '}';
          }
      }
      wsimport tool generate this artefact (with missing double "overral" field) :
      package moneytrackerconsoleclient.methods;
      
      import javax.xml.bind.annotation.XmlAccessType;
      import javax.xml.bind.annotation.XmlAccessorType;
      import javax.xml.bind.annotation.XmlElement;
      import javax.xml.bind.annotation.XmlType;
      
      
      /**
       * <p>Java class for userOutlay complex type.
       * 
       * <p>The following schema fragment specifies the expected content contained within this class.
       * 
       * <pre>
       * &lt;complexType name="userOutlay">
       *   &lt;complexContent>
       *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
       *       &lt;sequence>
       *         &lt;element name="datetime" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
       *         &lt;element name="product" type="{http://moneytracker.com/}product" minOccurs="0"/>
       *         &lt;element name="products_count" type="{http://www.w3.org/2001/XMLSchema}int"/>
       *         &lt;element name="user" type="{http://moneytracker.com/}user" minOccurs="0"/>
       *       &lt;/sequence>
       *     &lt;/restriction>
       *   &lt;/complexContent>
       * &lt;/complexType>
       * </pre>
       * 
       * 
       */
      @XmlAccessorType(XmlAccessType.FIELD)
      @XmlType(name = "userOutlay", propOrder = {
          "datetime",
          "product",
          "productsCount",
          "user"
      })
      public class UserOutlay {
      
          protected String datetime;
          protected Product product;
          @XmlElement(name = "products_count")
          protected int productsCount;
          protected User user;
      
          /**
           * Gets the value of the datetime property.
           * 
           * @return
           *     possible object is
           *     {@link String }
           *     
           */
          public String getDatetime() {
              return datetime;
          }
      
          /**
           * Sets the value of the datetime property.
           * 
           * @param value
           *     allowed object is
           *     {@link String }
           *     
           */
          public void setDatetime(String value) {
              this.datetime = value;
          }
      
          /**
           * Gets the value of the product property.
           * 
           * @return
           *     possible object is
           *     {@link Product }
           *     
           */
          public Product getProduct() {
              return product;
          }
      
          /**
           * Sets the value of the product property.
           * 
           * @param value
           *     allowed object is
           *     {@link Product }
           *     
           */
          public void setProduct(Product value) {
              this.product = value;
          }
      
          /**
           * Gets the value of the productsCount property.
           * 
           */
          public int getProductsCount() {
              return productsCount;
          }
      
          /**
           * Sets the value of the productsCount property.
           * 
           */
          public void setProductsCount(int value) {
              this.productsCount = value;
          }
      
          /**
           * Gets the value of the user property.
           * 
           * @return
           *     possible object is
           *     {@link User }
           *     
           */
          public User getUser() {
              return user;
          }
      
          /**
           * Sets the value of the user property.
           * 
           * @param value
           *     allowed object is
           *     {@link User }
           *     
           */
          public void setUser(User value) {
              this.user = value;
          }
      
      }
      Mu question is why generated artefact does'nt have "overral" property and what i must rewrite to fix that issue ?