Cayenne, Tapestry, Tomcat plumbling

From: Jin Lee (jinsle..mail.com)
Date: Fri Jan 14 2005 - 15:34:38 EST

  • Next message: Eric Schneider: "Re: Cayenne, Tapestry, Tomcat plumbling"

    Hey all,

    I've run into an error in Tapestry and I've narrowed it down somewhat
    and was wondering if I could get anyone's insight on how to resolve
    the problem.

    To start off, I have cayenne.jar, tapestry.jar, and all the
    dependencies in tomcat_home/shared/lib. Is this okay, or should it be
    in the context's path?

    The problem lies in Tapestry's IPropertySelection. I have this method:

        public IPropertySelectionModel getPrimaryInvestigators() {
            Visit visit = (Visit) getPage().getVisit();
            DataContext context = visit.getDataContext();
            SelectQuery q = new SelectQuery(Person.class);
            List persons = context.performQuery(q);
            context.commitChanges();
                return new PersonModel(persons);
        }

    which return this error:

    Unable to resolve expression 'primaryInvestigators' for
    assr.objects.NewASSR$Enhance_4..d5534[NewASSR].

    but when I change the body of the method to this it runs fine:

        public IPropertySelectionModel getPrimaryInvestigators() {
                return new
    org.apache.tapestry.form.StringPropertySelectionModel(new String[]
    {"Hi", "its", "working!"});
        }

    My PersonModel looks like this:

    public class PersonModel implements IPropertySelectionModel {
            
            private List persons;
            
            public PersonModel(List persons) {
                    this.persons = persons;
            }
            public int getOptionCount() {
                    return persons.size();
            }
            public Object getOption(int index) {
                    Person person = (Person)persons.get(index);
                    return person;
            }
            public String getLabel(int index) {
                    Person person = (Person)persons.get(index);
                    return person.getPersonLastName() + ", " + person.getPersonFirstName();
            }
            public String getValue(int index) {
                    Person person = (Person)persons.get(index);
                    return person.getObjectId().toString();
            }
            public Object translateValue(String value) {
                    int i;
                    for (i=0; i<persons.size(); i++) {
                            Person person = (Person) persons.get(i);
                            if (person.getObjectId().toString().equals(value)) {
                                    return person;
                            }
                    }
                    return null;
            }
    }

    So since a StringPropertySelectionModel works, I'm thinking its either
    1) I set up cayenne wrong, or 2) my implementation of PersonModel is
    just totally off.

    Any help would be greatly appreicated. Trying to learn both tapestry
    and cayenne at the same time so it's been quite a learning process.

    Thank you very much,

    Jin Lee



    This archive was generated by hypermail 2.0.0 : Fri Jan 14 2005 - 15:34:40 EST