Tuesday, January 3, 2012

Re: what could POSSIBLY be non transportable in this ValueType?

Nothing, as you only have one getter, getStartDate(), and java.util.Date is transportable. 

But the type itself is not transportable unless you have a corresponding ValueProxy interface defined in your shared code. Something like this: 

@ProxyFor(JobHistoryPK.class)
public interface JobHistoryPKProxy extends ValueProxy { 
   Date getStartDate();
}

More details on this here: 


On Tue, Jan 3, 2012 at 7:56 PM, Elhanan <elh.maayan@gmail.com> wrote:
@Embeddable
public class JobHistoryPK implements Serializable {
  private static final long serialVersionUID = 1L;

  @Column(name = "EMPLOYEE_ID")
  private Long employeeId;

  @Temporal(TemporalType.DATE)
  @Column(name = "START_DATE")
  private java.util.Date startDate;

  JobHistoryPK() {

  }

  public JobHistoryPK(final JobHistory history) {
    this(history.getEmployee(), history.getStartDate());
  }

  public JobHistoryPK(final Employee employee, final Date startDate) {
    super();
    employeeId = employee.getId();
    this.startDate = startDate;
  }

  java.util.Date getStartDate() {
    return startDate;
  }

  @Override
  public int hashCode() {
    final int prime = 31;
    int result = 1;
    result = prime * result + (int) (employeeId ^ (employeeId >>> 32));
    result = prime * result + ((startDate == null) ? 0 : startDate.hashCode());
    return result;
  }

  @Override
  public boolean equals(final Object obj) {
    if (this == obj) {
      return true;
    }
    if (obj == null) {
      return false;
    }
    if (getClass() != obj.getClass()) {
      return false;
    }
    final JobHistoryPK other = (JobHistoryPK) obj;
    if (employeeId != other.employeeId) {
      return false;
    }
    if (startDate == null) {
      if (other.startDate != null) {
        return false;
      }
    } else if (!startDate.equals(other.startDate)) {
      return false;
    }
    return true;
  }

  @Override
  public String toString() {
    return "JobHistoryId [employee_id=" + employeeId + ", startDate=" + startDate + "]";
  }

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/RItzYQx-M-EJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment