Re: Expression string

2008-03-05 Thread Eric Polino
Yeah, I'm trying that now. I hope that works. Wish someone could have pointed that out earlier, would have saved me about 6hrs of work! Thanks, Eric On 3/5/08, Mike Kienenberger <[EMAIL PROTECTED]> wrote: > Eric, > I looked back at your original example, and it seems to me that the > only thi

Re: Expression string

2008-03-05 Thread Mike Kienenberger
Eric, I looked back at your original example, and it seems to me that the only thing you need to do is to change it from Expression.fromString() to SQLTemplate, and #result-ize the "select * from SA.Site s" part and #bind-ize the parameter placeholders. On 3/5/08, Michael Gentry <[EMAIL PROTECTED]

Re: Expression string

2008-03-05 Thread Michael Gentry
When you use an SQLTemplate, you are generating the SQL (except for the caveats of #result and friends), not Cayenne. You can issue whatever SQL you want to the DB. /dev/mrg On Wed, Mar 5, 2008 at 2:37 PM, Eric Polino <[EMAIL PROTECTED]> wrote: > But the SQL supported by cayenne doesn't suppor

Re: Expression string

2008-03-05 Thread Eric Polino
On 3/5/08, Mike Kienenberger <[EMAIL PROTECTED]> wrote: > The code you posted doesn't seem like it'd compile: > setFetchinDataRows instead of setFetchin[g]DataRows Yeah, there are typos in that code, I was in the middle of doing work, but you get the gist of it. > > I don't understand why you n

Re: Expression string

2008-03-05 Thread Mike Kienenberger
The code you posted doesn't seem like it'd compile: setFetchinDataRows instead of setFetchin[g]DataRows I don't understand why you need multiple queries either. You can write whatever sql you like, so start by figuring out what you want to do in raw sql. Once you've got that, parameterize the p

Re: Expression string

2008-03-05 Thread Eric Polino
On 3/5/08, Eric Polino <[EMAIL PROTECTED]> wrote: > On 3/3/08, Andrus Adamchik <[EMAIL PROTECTED]> wrote: > > Two options: > > > > 1. SQLTemplate > > 2. Cayenne 3.0/EJBQL (with EJBQL is still sort of alpha, so for > > subqueries I'd suggest grabbing a nightly building following the link >

Re: Expression string

2008-03-05 Thread Eric Polino
On 3/3/08, Andrus Adamchik <[EMAIL PROTECTED]> wrote: > Two options: > > 1. SQLTemplate > 2. Cayenne 3.0/EJBQL (with EJBQL is still sort of alpha, so for > subqueries I'd suggest grabbing a nightly building following the link > on the download page: http://cayenne.apache.org/download.html OK.

Re: Expression string

2008-03-03 Thread Michael Gentry
This is a complete guess on my part since I'm not sure what you are trying to do: http://cayenne.apache.org/doc20/querychain.html /dev/mrg On Mon, Mar 3, 2008 at 4:39 PM, Eric Polino <[EMAIL PROTECTED]> wrote: > No, I'm moving over to using SQLTemplate. i see that > DataContext.performQueries

Re: Expression string

2008-03-03 Thread Eric Polino
No, I'm moving over to using SQLTemplate. i see that DataContext.performQueries() has been deprecated and the comment doesn't lead me to anything I understand. How do you perform a list of queries now? On 3/3/08, Michael Gentry <[EMAIL PROTECTED]> wrote: > You probably want to switch over to SQL

Re: Expression string

2008-03-03 Thread Michael Gentry
You probably want to switch over to SQLTemplate: http://cayenne.apache.org/doc20/sqltemplate-query.html It can return data objects for you, which I believe is what you want. You might be able to rewrite your SQL, too, in a manner that would work with Expression.fromString. On Mon, Mar 3, 2008 at

Re: Expression string

2008-03-03 Thread Andrus Adamchik
Two options: 1. SQLTemplate 2. Cayenne 3.0/EJBQL (with EJBQL is still sort of alpha, so for subqueries I'd suggest grabbing a nightly building following the link on the download page: http://cayenne.apache.org/download.html Andrus On Mar 3, 2008, at 11:19 PM, Eric Polino wrote: Alright,

Re: Expression string

2008-03-03 Thread Eric Polino
Alright, well that clears up some stuff, now I'm getting issues with running an exists statement? I see from the grammar that it doesn't support them. Anyone know how to run an exists like statement? ...of course, without looping through each element of hte super query and testing them individua

Re: Expression string

2008-03-03 Thread Andrus Adamchik
On Mar 3, 2008, at 11:05 PM, Michael Gentry wrote: I could be mistaken here, but I don't believe that Expression.fromString() supports "select...". Exactly. The closest thing it resembles is EJBQL syntax [1]. But that would require Cayenne 3.0 and a different type of query - EJBQLQuery. A

Re: Expression string

2008-03-03 Thread Michael Gentry
I could be mistaken here, but I don't believe that Expression.fromString() supports "select...". I know I've never used it that way. I've always started with the WHERE clause as shown on this page: http://cayenne.apache.org/doc20/building-expressions.html The BNF likewise does not list SELECT,

Re: Expression string

2008-03-03 Thread Eric Polino
I'm not using SQLTemplate, I'm using Expression.fromString() On 3/3/08, Mike Kienenberger <[EMAIL PROTECTED]> wrote: > I may very well be wrong, but don't you have to use #result macros to > assign specific types and values for each result in the map instead of > using "select *"? > > From revi

Re: Expression string

2008-03-03 Thread Mike Kienenberger
I may very well be wrong, but don't you have to use #result macros to assign specific types and values for each result in the map instead of using "select *"? >From reviewing my own SQLTemplate code "select" + " #result('s.ID' 'long' 'ID')," + " #result('s.SHOR

Re: Expression string

2008-03-03 Thread Eric Polino
> > > > Expression exp = Expression.fromString( > > "select * from SA.Site s" + > > "where not exists ( "+ Small typo fix. It wasn't in my code, just in the copied version in the email. There's a space after the 's' in "SA.Site s". So the first line reads "sel

Re: Expression string

2008-03-03 Thread Eric Polino
ing > some issues with the subqueries. > > > Fredrik Liden > ENLASO Corp. > > > > -Original Message- > From: Eric Polino [mailto:[EMAIL PROTECTED] > Sent: Monday, March 03, 2008 1:30 PM > To: user@cayenne.apache.org > Subject: Expression string

RE: Expression string

2008-03-03 Thread Fredrik Liden
onday, March 03, 2008 1:30 PM To: user@cayenne.apache.org Subject: Expression string I'm trying to query my db with the following setup and it keep getting Expression parsing errors Expression exp = Expression.fromString( "select * from SA.Site s" +

Expression string

2008-03-03 Thread Eric Polino
I'm trying to query my db with the following setup and it keep getting Expression parsing errors Expression exp = Expression.fromString( "select * from SA.Site s" + "where not exists ( "+ "select * from SA.Reservation r " + "where " +