Thank you so much for your reply.  I modified the request like so:
requestFactory.formRequest().findForm(1).with("fieldsList").fire(...
but now I get an UnexectedException with this message:
Could not determine getter for property value on type Field
Thanks again.


On Oct 17, 11:20 pm, "Aidan O'Kelly" <aida...@gmail.com> wrote:
> When you find(), or return an object from other method through
> RequestFactory on the client-side, relationships, such as a List<MyProxy>
> need to be explicitly retrieved, using syntax like:
>
>  requestFactory.formRequest().findForm(1).with('"fieldList").fire(...
>
> http://code.google.com/webtoolkit/doc/latest/DevGuideRequestFactory.h...
>
>
>
>
>
>
>
> On Tue, Oct 18, 2011 at 3:52 AM, 007design <0...@007design.com> wrote:
> > I'm trying to understand RequestFactory but having quite a difficult
> > time.  First, one note: I'm using ORMLite for persistence, I found it
> > easier and simpler to learn than Hibernate so I'm hoping I can
> > continue to use it.  Those are the @Database annotations in example
> > below.  I've boiled down my application to a smaller amount of code.
> > I'm really hoping someone can take a quick look at it and tell me what
> > I'm doing wrong.  When I try and load the application in the browser I
> > get a NullPointerException on response.getFieldsList().  I'm guessing
> > that after the Form object is fetched from the database the
> > "connection is closed" or something so calling getFieldsList() doesn't
> > work because the method "gets more data from the database".
>
> > public class FormBuilder implements EntryPoint {
> >        public void onModuleLoad() {
> >                final Label label = new Label();
> >                RootPanel.get("labelContainer").add(label);
>
> >                final EventBus eventBus = new SimpleEventBus();
> >                EntityRequestFactory requestFactory =
> > GWT.create(EntityRequestFactory.class);
> >                requestFactory.initialize(eventBus);
>
> >                requestFactory.formRequest().findForm(1).fire(new
> > Receiver<FormProxy>() {
> >                        @Override
> >                        public void onSuccess(FormProxy response) {
> >                                for (FieldProxy field :
> > response.getFieldsList()) {
> >                                        label.setText(label.getText() +
> > field.getName());
> >                                }
> >                        }
> >                });
> >        }
> > }
>
> > @DatabaseTable (tableName="forms")
> > public class Form {
> >        public Form() {}
>
> >        @DatabaseField (columnName="form_id", generatedId=true)
> >        private Integer id;
> >        public void setId(Integer id) { this.id = id; }
> >        public Integer getId() { return id; }
>
> >        public List<Field> getFieldsList() {
> >                return Field.getFieldsList(getId());
> >        }
>
> >        public static Form findForm(Integer id) {
> >                // Get form record from database
> >        }
>
> > }
>
> > public class Field {
> >        public Field() {}
>
> >        @DatabaseField (columnName="field_id", generatedId=true)
> >        private Integer id;
> >        public void setId(Integer id) { this.id = id; }
> >        public Integer getId() { return id; }
>
> >        /**
> >         * The form to which this field is associated
> >         */
> >        private Integer formId;
> >        public void setFormId(Integer formId) { this.formId = formId; }
> >        public Integer getFormId() { return this.formId; }
>
> >        public Form getForm() {
> >                return Form.findForm(getFormId());
> >        }
>
> >        public static Field findField(Integer id) {
> >                // Get field record from database
> >        }
>
> >        public static List<Field> getFieldsList(Integer id) {
> >                // Get field records for db where formid = id
> >        }
> > }
>
> > @ProxyFor (Form.class)
> > public interface FormProxy extends EntityProxy {
> >        Integer getId();
> >        List<FieldProxy> getFieldsList();
> >        void setId(Integer id);
> >        void setTimestamp(Date timestamp);
> > }
>
> > @ProxyFor (Field.class)
> > public interface FieldProxy extends EntityProxy {
> >        Integer getFormId();
> >        Integer getId();
> >        void setFormId(Integer formId);
> >        void setId(Integer id);
> > }
>
> > @Service (Form.class)
> > public interface FormRequest extends RequestContext {
> >        Request<FormProxy> findForm(Integer id);
> >        InstanceRequest<FormProxy, List<FieldProxy>> getFieldsList();
> > }
>
> > @Service (Field.class)
> > public interface FieldRequest extends RequestContext {
> >        Request<FieldProxy> findField(Integer id);
> >        Request<List<FieldProxy>> getFieldsList(Integer formId);
> > }
>
> > --
> > 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.

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