[prev in list] [next in list] [prev in thread] [next in thread]
List: castor-user
Subject: Re: [castor-user] Problem Querying
From: Bruce Snyder <bruce.snyder () gmail ! com>
Date: 2005-03-23 15:21:54
Message-ID: 7b3355cb0503230721520d22ba () mail ! gmail ! com
[Download RAW message or body]
On Mon, 21 Mar 2005 08:54:02 -0500, Mike Wannamaker
<Mike.Wannamaker@kingston.hummingbird.com> wrote:
Mike,
Please see my comments inline below:
> I have the included mapping and schema file. I have a ListingInfo that
> contains OpenHouse array. I want to be able to query against the OpenHouse
> array. I want to get all ListingInfo objects that have OpenHouses.startTime
> < a certain date.
>
> I tried doing the following:
>
> "SELECT o FROM com.goodtobehome.core.data.ListingInfo o WHERE
> o.openHouses.startTime < $1"
>
> I didn't capture stack trace but it gave me an error complaining about
> openHouses.startTime, no field or somehting like that?
>
> Then I tried:
>
> "SELECT o FROM com.goodtobehome.core.data.OpenHouse o WHERE o.startTime <
> $1"
>
> This gives me this exception:
> Mar 21, 2005 1:03:30 AM [EXCEP] CastorHelper: query(SELECT o FROM
> com.goodtobehome.core.data.OpenHouse o WHERE o.startTime < $1): Could not
> find mapping for class com.goodtobehome.core.data.OpenHouse
> org.exolab.castor.jdo.QueryException: Could not find mapping for class
> com.goodtobehome.core.data.OpenHouse
> at
> org.exolab.castor.jdo.oql.ParseTreeWalker.checkFromPart(ParseTreeWalker.java
> :309)
> at
> org.exolab.castor.jdo.oql.ParseTreeWalker.checkErrors(ParseTreeWalker.java:2
> 23)
> at
> org.exolab.castor.jdo.oql.ParseTreeWalker.<init>(ParseTreeWalker.java:137)
> at
> org.exolab.castor.jdo.engine.OQLQueryImpl.create(OQLQueryImpl.java:248)
> at
> org.exolab.castor.jdo.engine.DatabaseImpl.getOQLQuery(DatabaseImpl.java:465)
> at com.goodtobehome.util.CastorHelper.query(CastorHelper.java:250)
> at com.goodtobehome.util.CastorHelper.query(CastorHelper.java:236)
> at
> com.goodtobehome.core.handlers.ListingsSearchHandler.submitSearch(ListingsSe
> archHandler.java:59)
> at
> com.goodtobehome.core.handlers.ListingsSearchHandlerTest.testOpenHouseListin
> gsSearch(ListingsSearchHandlerTest.java:44)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
> )
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
> .java:25)
> at java.lang.reflect.Method.invoke(Method.java:324)
>
> How can I get this query to work?
In my experience, the error is usually an issue with the order of the
mapping descriptor. Move the entire <class /> element up above the
ListInfo <class /> element and see if that works.
> Second Question, how could I store the Credential object of UserAccount into
> the same table as UserAccount? Right now they are in separate tables.
You should be able to achieve this by just mapping the Credential
object to a subset of the columns in the useraccts table. Are you
planning on moving the username and pwd columns into the useraccts
table? Take a look a the following tip:
http://www.castor.org/tips-tricks.html#JDO:-Views-of-Same-Object
Bruce
--
perl -e 'print unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
);'
The Castor Project
http://www.castor.org/
Apache Geronimo
http://geronimo.apache.org/
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
minimalist@exolab.org with a subject of:
unsubscribe castor-user
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic