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<Tag> {

        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 <i>other</i> 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<Tag> getTags () {
                ISurveysDB db = SurveysDB.getInstance();
                return new ArrayList<Tag>(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.requestfactory.shared.Service;

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

@Service(Tag.class)
public interface TagRequest extends RequestContext {
        public Request<List<Tag>> getTags ();
}
-------------------------------------------------------------------------------------------------------------------------------------
package edu.hope.cs.surveys.editor.client;

import com.google.web.bindery.requestfactory.shared.RequestFactory;

public interface SurveysRequestFactory extends RequestFactory {
        public TagRequest tagRequest ();
}
-------------------------------------------------------------------------------------------------------------------------------------
//  Initialization of RequestFactory mechanism occurs in response to
button click:
testButton.addClickHandler(new ClickHandler() {

                        @Override
                        public void onClick(ClickEvent arg0) {
                                final EventBus eventBus = new SimpleEventBus();
                                SurveysRequestFactory requestFactory =
GWT.create(SurveysRequestFactory.class);
                                requestFactory.initialize(eventBus);
                        }
                });

-- 
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.

Reply via email to