what could POSSIBLY be non transportable in this ValueType?

44 views
Skip to first unread message

Elhanan

unread,
Jan 3, 2012, 2:56:24 PM1/3/12
to google-we...@googlegroups.com
@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 + "]";
  }

Aidan O'Kelly

unread,
Jan 3, 2012, 3:43:42 PM1/3/12
to google-we...@googlegroups.com
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: 


--
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-we...@googlegroups.com.
To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

Elhanan Maayan

unread,
Jan 3, 2012, 3:47:10 PM1/3/12
to google-we...@googlegroups.com
yep i had that as well.. but still the same exception.
@ProxyFor(value = JobHistoryPK.class)
public interface JobHistoryPKProxy extends ValueProxy {

  java.util.Date getStartDate();
}

i've been trying to dig around in the deobfuscator code and the domainToClientType map doesn't even show the ValueProxy entry. 

Aidan O'Kelly

unread,
Jan 3, 2012, 4:12:02 PM1/3/12
to google-we...@googlegroups.com
Are there any other proxies that return JobHistoryPKProxy from a getter?  
Or a service method that returns a JobHistoryPKProxy directly? 

RF will ignore proxies it can't reach, (ie there's no method returning/using them anywhere) but that shouldn't be the case unless they are un-used. Can you post the place where the JobHistoryPKProxy is used ?  

Thomas Broyer

unread,
Jan 3, 2012, 5:42:45 PM1/3/12
to google-we...@googlegroups.com
Your zero-args ctor and getter are not public, is this intended? RF only uses public members and actors (that last one could be circumvented using a Locator)

Elhanan Maayan

unread,
Jan 3, 2012, 10:58:53 PM1/3/12
to google-we...@googlegroups.com
the zero stuff is intended to be package level (hell i only placed because rf),. but even with public ctor it doesn't work.

On Wed, Jan 4, 2012 at 12:42 AM, Thomas Broyer <t.br...@gmail.com> wrote:
Your zero-args ctor and getter are not public, is this intended? RF only uses public members and actors (that last one could be circumvented using a Locator)
--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.

Elhanan Maayan

unread,
Jan 3, 2012, 11:02:42 PM1/3/12
to google-we...@googlegroups.com
actually there are no proxies that return it EXPLICITLY see JobHistoryPK itself is an embeddedid class which means it's used as a derived primary key in JobHistory, (composed from many to one of employee and one simple attribute) i could always defined getId of JobHistoryPKProxy in the proxy, but as i understand you don't define getId's in the proxy, as this is why they have the locators

Thomas Broyer

unread,
Jan 4, 2012, 5:17:54 AM1/4/12
to google-we...@googlegroups.com
You'll have to define that getId() here, only to have a reference to JobHistoryPK. Maybe @ExtraTypes would work but I haven't tried it; defining a getId() (even if you don't use it) will definitely work though (and if you don't include a with("id"), it won't add any bloat to the payloads on the wire)

Thomas Broyer

unread,
Jan 4, 2012, 5:18:44 AM1/4/12
to google-we...@googlegroups.com
How about the getStartDate()?

Elhanan Maayan

unread,
Jan 4, 2012, 5:21:13 AM1/4/12
to google-we...@googlegroups.com

What about iT ?

On Jan 4, 2012 12:19 PM, "Thomas Broyer" <t.br...@gmail.com> wrote:
How about the getStartDate()?

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.

Thomas Broyer

unread,
Jan 4, 2012, 5:23:12 AM1/4/12
to google-we...@googlegroups.com
The getStartDate() getter is not public in your class, but mapped on the proxy.

Elhanan Maayan

unread,
Jan 4, 2012, 5:24:57 AM1/4/12
to google-we...@googlegroups.com

You mean everything must be public?

On Jan 4, 2012 12:23 PM, "Thomas Broyer" <t.br...@gmail.com> wrote:
The getStartDate() getter is not public in your class, but mapped on the proxy.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.

Elhanan

unread,
Jan 4, 2012, 12:12:27 PM1/4/12
to google-we...@googlegroups.com
i'm beginning to think something is messed up here, in my attempt to simply stuff i created another embedded class called contacts , for the employee class it has only 2 fields of string values.
my first run failed with the "must run validation tool" exception, so i did what i nomally do in sich cases rename the .apt folder from .apt_generated to .apt.gen this sorted out.

now EVERYTHING worked fine, include the original proxy, i returned to hide the getFirstDate to package level and got "could not locate getter for FIrstDate" which now makes sense (inlike the can't send JobHistoryProxy to client message i got before) 

i also remove the getId from the JobHistoryProxy and it STILL worked.

how is it that the GWT apt messes up the project so much? 

Thomas Broyer

unread,
Jan 4, 2012, 12:26:18 PM1/4/12
to google-we...@googlegroups.com
I suspect it's *Eclipse* which messes things up actually.

Elhanan Maayan

unread,
Jan 4, 2012, 12:28:02 PM1/4/12
to google-we...@googlegroups.com
yea, i think there's a bug somewhere about it. 

On Wed, Jan 4, 2012 at 7:26 PM, Thomas Broyer <t.br...@gmail.com> wrote:
I suspect it's *Eclipse* which messes things up actually.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
Reply all
Reply to author
Forward
0 new messages