Re: [appfuse-user] How to query in Hibernate 3

2007-05-03 Thread Matt Campbell
Oh sorry, just noticed your Class name is Category in your first post. Do you have another class called Categories? I assume not. This query should work: public List getMaleCategories() { return getHibernateTemplate().find("from Category cat where cat.male_only=?", Boolean.TRUE); } On 5/

Re: [appfuse-user] How to query in Hibernate 3

2007-05-03 Thread Matt Campbell
Does this work for you? public List getMaleCategories() { return getHibernateTemplate().find("from Categories cat where cat.male_only=?", Boolean.TRUE); } On 5/3/07, sionsmith <[EMAIL PROTECTED]> wrote: Funny enough it was already present in the hibernate.cfg.xml file as this statement

Re: [appfuse-user] How to query in Hibernate 3

2007-05-03 Thread sionsmith
Funny enough it was already present in the hibernate.cfg.xml file as this statement works & returns the correct result set back to me: public List getCategories(){ return getHibernateTemplate().find("from Category cat order by upper(cat.name)"); } That statement works fine - its just

Re: [appfuse-user] How to query in Hibernate 3

2007-05-02 Thread Michael Horwitz
Looks like you need to add your category class/hbm.xml to the session factory configuration. Which version of AppFuse are you using? If 2.0-m*, then you should add the classname to hibernate.cfg.xml. Mike On 5/2/07, sionsmith <[EMAIL PROTECTED]> wrote: I've tried that - neither worked - mayb

Re: [appfuse-user] How to query in Hibernate 3

2007-05-02 Thread sionsmith
I've tried that - neither worked - mayb i have something in my Category.class wrong? this is the error i got: === EXCEPTION == Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethod

Re: [appfuse-user] How to query in Hibernate 3

2007-05-02 Thread Michael Horwitz
I think the problem is less your query, more the method you are using on HibernateTemplate. This should work for you: public List getMaleCategories() { return getHibernateTemplate().find("from Categories where male_only=?", Boolean.TRUE); } The named query form of the find method is used w

[appfuse-user] How to query in Hibernate 3

2007-05-02 Thread sionsmith
Quick questions Guys & Girls - I'm new to hibernate 3 and unsure how to write the following in a query: I have a Categories table in the DB, with a boolean flag as one of the attributes, i want to return a list of all the items which have the boolean set to true. This is what i tried using, but i