Re: Problems using RequestFactory

2011-06-08 Thread Thomas Broyer


On Wednesday, June 8, 2011 3:50:08 PM UTC+2, Ryan McFall wrote:
>
> It was through looking through the GWT source that I realized the 
> source of my error, so that's definitely a good pointer. 
>
> It would have helped me if the error message was: 
> Invalid request parameterization: 
> edu.hope.cs.surveys.dao.pojo.Tag must extend EntityProxy 
>
> I think that would be a valid error message, right?  Adding "must 
> extend EntityProxy" would seem to make it quite clear what had gone 
> wrong.


If it had been the case, the Request would have been declared as Request, but it's not, because you can have a 
Request>, or a Request or Request (or 
Request>), which obviously don't extend BaseProxy.

If you declared a Request where you erroneously imported java.sql.Date 
instead of java.util.Date, having "Invalid Request parameterization: 
java.sql.Date must extend BaseProxy" would be inaccurate and probably more 
confusing than without the "must extend".

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



Re: Problems using RequestFactory

2011-06-08 Thread Ryan McFall
It was through looking through the GWT source that I realized the
source of my error, so that's definitely a good pointer.

It would have helped me if the error message was:
Invalid request parameterization:
edu.hope.cs.surveys.dao.pojo.Tag must extend EntityProxy

I think that would be a valid error message, right?  Adding "must
extend EntityProxy" would seem to make it quite clear what had gone
wrong.

Ryan

On Jun 7, 5:05 pm, Thomas Broyer  wrote:
> On Tuesday, June 7, 2011 9:56:10 PM UTC+2, Ryan McFall wrote:
>
> > For others who might see this message, I quickly discovered my
> > problem.  In the TagRequest class (which extends RequestContext), the
> > method getTags is declared to return a List.  That should have
> > been List, as ITag is the interface which extends EntityProxy.
> > The error message seems to indicate to me there is something wrong
> > with the Tag class, rather than the true source of the error.  Perhaps
> > the error message could have been different, but I place at least 90%
> > of the blame squarely on my own shoulders :-)
>
> Searching for the error message in GWT's code [1] which lead to this method
> [2], where you can see what types are checked: "Simple values, like Integer
> and String", "EntityProxy and ValueProxy return types", Collection, or Map.
> But well, I an't find a way to make this message clearer without making it
> too long: "invalid Request parameterization" clearly means the type
> parameter is wrong, not what's *in* that type, but the type itself (i.e. the
> classes or interfaces it extends)
>
> [1]http://www.google.com/codesearch?q=%22Invalid+Request+parameterizatio...
>
> [2]http://www.google.com/codesearch/p#A1edwVHBClQ/user/src/com/google/we...

-- 
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: Problems using RequestFactory

2011-06-07 Thread Thomas Broyer


On Tuesday, June 7, 2011 9:56:10 PM UTC+2, Ryan McFall wrote:
>
> For others who might see this message, I quickly discovered my 
> problem.  In the TagRequest class (which extends RequestContext), the 
> method getTags is declared to return a List.  That should have 
> been List, as ITag is the interface which extends EntityProxy. 
> The error message seems to indicate to me there is something wrong 
> with the Tag class, rather than the true source of the error.  Perhaps 
> the error message could have been different, but I place at least 90% 
> of the blame squarely on my own shoulders :-)


Searching for the error message in GWT's code [1] which lead to this method 
[2], where you can see what types are checked: "Simple values, like Integer 
and String", "EntityProxy and ValueProxy return types", Collection, or Map.
But well, I an't find a way to make this message clearer without making it 
too long: "invalid Request parameterization" clearly means the type 
parameter is wrong, not what's *in* that type, but the type itself (i.e. the 
classes or interfaces it extends)

[1] 
http://www.google.com/codesearch?q=%22Invalid+Request+parameterization%22+package%3Ahttp%3A%2F%2Fgoogle-web-toolkit%5C.googlecode%5C.com
 
[2] 
http://www.google.com/codesearch/p#A1edwVHBClQ/user/src/com/google/web/bindery/requestfactory/gwt/rebind/model/RequestFactoryModel.java&q=%22Invalid%20Request%20parameterization%22%20package:http://google-web-toolkit%5C.googlecode%5C.com&l=397

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



Re: Problems using RequestFactory

2011-06-07 Thread Thomas Broyer


On Tuesday, June 7, 2011 6:30:01 PM UTC+2, Hilco wrote:
>
> On 6 June 2011 11:02, Ryan McFall  wrote:
> > @ProxyFor(Tag.class)
> > public interface ITag extends EntityProxy {
> >public boolean isPublic ();
> >public void setPublic (boolean isPublic);
>
> I'm guessing these might be a problem. Firstly, normal boolean getters
> don't seem to work (i.e. is*, has*). This may have changed in GWT2.3,
> though (I haven't tried).
>
FYI, it has: 
http://code.google.com/p/google-web-toolkit/issues/detail?id=5902
 

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



Re: Problems using RequestFactory

2011-06-07 Thread Ryan McFall
For others who might see this message, I quickly discovered my
problem.  In the TagRequest class (which extends RequestContext), the
method getTags is declared to return a List.  That should have
been List, as ITag is the interface which extends EntityProxy.
The error message seems to indicate to me there is something wrong
with the Tag class, rather than the true source of the error.  Perhaps
the error message could have been different, but I place at least 90%
of the blame squarely on my own shoulders :-)

Ryan

On Jun 6, 2:02 pm, Ryan McFall  wrote:
> I am migrating an application which used Gilead as the go-between
> between Hibernate and GWT to use RequestFactory.  I am having a
> problem where the RequestFactoryGenerator doesn't want to generate a
> RequestFactory for my service.  The error I see in the Development
> Mode console is:
>
> [ERROR] [surveyeditor] - Invalid Request parameterization
> edu.hope.cs.surveys.dao.pojo.Tag
>
> I have tried simplifying Tag as much as possible - in particular, it
> used to implement java.io.Serializable, but now it does not.
>
> It's not clear to me what the possible reasons for the above error
> might be, so it's kind of hard to diagnose.
>
> Below are the relevant interfaces/classes.  Thanks in advance for any
> ideas.
>
> Ryan
>
> -
> package edu.hope.cs.surveys.dao;
>
> import com.google.web.bindery.requestfactory.shared.EntityProxy;
> import com.google.web.bindery.requestfactory.shared.ProxyFor;
>
> import edu.hope.cs.surveys.dao.pojo.Tag;
>
> @ProxyFor(Tag.class)
> public interface ITag extends EntityProxy {
>         public Integer getTagID ();
>         public String getTagText ();
>         public String getOwner ();
>         public boolean isPublic ();
>
>         public void setTagID (int id);
>         public void setTagText (String text);
>         public void setOwner (String ownerName);
>         public void setPublic (boolean isPublic);}
>
> -
> package edu.hope.cs.surveys.dao.pojo;
>
> import java.io.Serializable;
> import java.util.ArrayList;
> import java.util.List;
>
> import javax.persistence.Basic;
> import javax.persistence.Column;
> import javax.persistence.Entity;
> import javax.persistence.GeneratedValue;
> import javax.persistence.GenerationType;
> import javax.persistence.Id;
> import javax.persistence.Table;
> import javax.persistence.Transient;
>
> import org.hibernate.Session;
> import org.hibernate.annotations.Type;
>
> import edu.hope.cs.surveys.dao.ITag;
> import edu.hope.cs.surveys.database.HibernateUtil;
> import edu.hope.cs.surveys.database.ISurveysDB;
> import edu.hope.cs.surveys.database.SurveysDB;
>
> @Entity
> @Table(name="Tags")
> public class Tag implements Comparable {
>
>         private Integer tagID;
>         private String tagText;
>         private String owner;
>         private boolean isPublic;
>
>         public Tag () {
>                 isPublic = true;
>         }
>
>         @Id
>         @GeneratedValue(strategy=GenerationType.AUTO)
>         public Integer getTagID() {
>                 return tagID;
>         }
>
>         @Basic
>         public String getTagText() {
>                 return tagText;
>         }
>
>         @Basic
>         public String getOwner() {
>                 return owner;
>         }
>
>         @Column(name="IsPublic")
>         @Type(type="edu.hope.cs.surveys.dao.pojo.YesNo")
>         public boolean isPublic() {
>                 return isPublic;
>         }
>
>         public void setTagID(int iD) {
>                 tagID = iD;
>         }
>
>         public void setTagText(String tagText) {
>                 this.tagText = tagText;
>         }
>
>         public void setOwner(String owner) {
>                 this.owner = owner;
>         }
>
>         public void setPublic(boolean isPublic) {
>                 this.isPublic = isPublic;
>         }
>
>         /**
>          * Compares this tag to the tag other based upon the
> Comparable
>          * interface.  In this case the tag text values are compared.
>          */
>         @Override
>         public int compareTo(Tag other) {
>                 return tagText.compareTo(other.getTagText());
>         }
>
>         @Override
>         public boolean equals(Object arg0) {
>                 if (!(arg0 instanceof ITag)) {
>                         return false;
>                 }
>
>                 ITag other = (ITag) arg0;
>
>                 return this.getTagID() == other.getTagID();
>         }
>
>         /*  Methods associated with the request factory implementation  */
>         @Transient
>         public Long getId () {
>                 return new Long(getTagID());
>         }
>
>         @Transient
>         public Integer getVersion () {
>   

Re: Problems using RequestFactory

2011-06-07 Thread Hilco Wijbenga
On 6 June 2011 11:02, Ryan McFall  wrote:
> I am migrating an application which used Gilead as the go-between
> between Hibernate and GWT to use RequestFactory.  I am having a
> problem where the RequestFactoryGenerator doesn't want to generate a
> RequestFactory for my service.  The error I see in the Development
> Mode console is:
>
> [ERROR] [surveyeditor] - Invalid Request parameterization
> edu.hope.cs.surveys.dao.pojo.Tag
>
> I have tried simplifying Tag as much as possible - in particular, it
> used to implement java.io.Serializable, but now it does not.
>
> It's not clear to me what the possible reasons for the above error
> might be, so it's kind of hard to diagnose.
>
> Below are the relevant interfaces/classes.  Thanks in advance for any
> ideas.
>
> Ryan
>
> -
> package edu.hope.cs.surveys.dao;
>
> import com.google.web.bindery.requestfactory.shared.EntityProxy;
> import com.google.web.bindery.requestfactory.shared.ProxyFor;
>
> import edu.hope.cs.surveys.dao.pojo.Tag;
>
> @ProxyFor(Tag.class)
> public interface ITag extends EntityProxy {
>        public boolean isPublic ();
>        public void setPublic (boolean isPublic);

I'm guessing these might be a problem. Firstly, normal boolean getters
don't seem to work (i.e. is*, has*). This may have changed in GWT2.3,
though (I haven't tried). Secondly, setPublic might generate a
parameter "public" which would not compile.

-- 
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Problems using RequestFactory

2011-06-07 Thread Ryan McFall
I am migrating an application which used Gilead as the go-between
between Hibernate and GWT to use RequestFactory.  I am having a
problem where the RequestFactoryGenerator doesn't want to generate a
RequestFactory for my service.  The error I see in the Development
Mode console is:

[ERROR] [surveyeditor] - Invalid Request parameterization
edu.hope.cs.surveys.dao.pojo.Tag

I have tried simplifying Tag as much as possible - in particular, it
used to implement java.io.Serializable, but now it does not.

It's not clear to me what the possible reasons for the above error
might be, so it's kind of hard to diagnose.

Below are the relevant interfaces/classes.  Thanks in advance for any
ideas.

Ryan

-
package edu.hope.cs.surveys.dao;

import com.google.web.bindery.requestfactory.shared.EntityProxy;
import com.google.web.bindery.requestfactory.shared.ProxyFor;

import edu.hope.cs.surveys.dao.pojo.Tag;

@ProxyFor(Tag.class)
public interface ITag extends EntityProxy {
public Integer getTagID ();
public String getTagText ();
public String getOwner ();
public boolean isPublic ();

public void setTagID (int id);
public void setTagText (String text);
public void setOwner (String ownerName);
public void setPublic (boolean isPublic);
}
-
package edu.hope.cs.surveys.dao.pojo;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.hibernate.Session;
import org.hibernate.annotations.Type;

import edu.hope.cs.surveys.dao.ITag;
import edu.hope.cs.surveys.database.HibernateUtil;
import edu.hope.cs.surveys.database.ISurveysDB;
import edu.hope.cs.surveys.database.SurveysDB;

@Entity
@Table(name="Tags")
public class Tag implements Comparable {

private Integer tagID;
private String tagText;
private String owner;
private boolean isPublic;

public Tag () {
isPublic = true;
}

@Id
@GeneratedValue(strategy=GenerationType.AUTO)
public Integer getTagID() {
return tagID;
}


@Basic
public String getTagText() {
return tagText;
}


@Basic
public String getOwner() {
return owner;
}


@Column(name="IsPublic")
@Type(type="edu.hope.cs.surveys.dao.pojo.YesNo")
public boolean isPublic() {
return isPublic;
}


public void setTagID(int iD) {
tagID = iD;
}


public void setTagText(String tagText) {
this.tagText = tagText;
}


public void setOwner(String owner) {
this.owner = owner;
}


public void setPublic(boolean isPublic) {
this.isPublic = isPublic;
}

/**
 * Compares this tag to the tag other based upon the
Comparable
 * interface.  In this case the tag text values are compared.
 */
@Override
public int compareTo(Tag other) {
return tagText.compareTo(other.getTagText());
}

@Override
public boolean equals(Object arg0) {
if (!(arg0 instanceof ITag)) {
return false;
}

ITag other = (ITag) arg0;

return this.getTagID() == other.getTagID();
}

/*  Methods associated with the request factory implementation  */
@Transient
public Long getId () {
return new Long(getTagID());
}

@Transient
public Integer getVersion () {
return 0;
}

public static Tag findEntity(Long id) {
Session session = HibernateUtil.getCurrentSession();
Tag tag = (Tag) session.load (Tag.class, id);
return tag;
}

public static List getTags () {
ISurveysDB db = SurveysDB.getInstance();
return new ArrayList(db.getAvailableTags("surveys", true));
}
}
-
package edu.hope.cs.surveys.editor.client;

import java.util.List;

import com.google.web.bindery.requestfactory.shared.Request;
import com.google.web.bindery.requestfactory.shared.RequestContext;
import com.google.web.bindery.requestfact