Re: help needed with query
Re: help needed with query
- Subject: Re: help needed with query
- From: Theodore Petrosky <email@hidden>
- Date: Mon, 4 Feb 2008 08:07:16 -0800 (PST)
Thanks for the replies... yes I did not want to send
raw SQL... I didn't realize that I could create a
FetchSpecification that did what I needed... I already
had the relation set up, so that was all I was missing
was the part about where to create this fetchSpec...
It's working fine now. Thanks everyone...
Ted
--- Don Lindsay <email@hidden> wrote:
> Looks like you are working too hard. :) WebObjects
> does many things
> for you, if you are expending a lot of effort to
> accomplish
> something, it is probably can be done simpler using
> WebObjects.
>
> You can run a query directly, but I would recommend
> using a fetch
> specification to retrieve the records from the
> editing context and
> not running a query. At least then your objects are
> up to date with
> the database and are refreshed as needed by the EOF.
>
> But if you really really really really really want
> to write a
> passthough SQL in WebObjects, I wouldn't recommend
> it, here is the code:
>
> String sqlString = "SELECT * FROM USERS";
> try {
> NSArray oResult =
> EOUtilities.rawRowsForSQL(session
>
().defaultEditingContext(),"EOMODELNAMEGOESHERE",sqlString);
> } catch (Exception e) {
> //oops error occurred.
> }
>
> Thanks,
>
> Don
>
> On Feb 4, 2008, at 8:57 AM, Theodore Petrosky wrote:
>
> > First, most of my experience is with cocoa. I
> could
> > write any query I wanted even across
> relationships. I
> > am having a problem with relationship in WO.
> >
> > I am starting out with a new simple setup. My db
> is
> > normalized like this
> >
> > table names:
> > firstname text
> > lastname text
> > nameid (serial)
> >
> > namesbusinessmeta:
> > iscurrent bool default true
> > phonenumber text
> > extension text
> > nbmid
> > namesFKid foreign key to names
> >
> > I have a trigger and function on the db that
> creates a
> > new insert into namesbusinessmeta with the
> referenced
> > foreign key on insert into the names table.
> >
> > This works fine.
> >
> > but now I want to query from my WO app.
> > select * from names where nameid in (select
> namesFKid
> > from namesbusinessmeta where iscurrent = true)
> order
> > by lastname;
> >
> > I am lost.... I want an array of current employees
> > where the iscurrent bool is in relationship
> table.
> >
> > Maybe I am barking up the wrong tree......
> >
> > Ted
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
>
______________________________________________________________________
>
> > ______________
> > Looking for last minute shopping deals?
> > Find them fast with Yahoo! Search.
> http://tools.search.yahoo.com/
> > newsearch/category.php?category=shopping
> > _______________________________________________
> > Do not post admin requests to the list. They will
> be ignored.
> > Webobjects-dev mailing list
> (email@hidden)
> > Help/Unsubscribe/Update your Subscription:
> >
>
>
> > 40mac.com
> >
> > This email sent to email@hidden
>
>
____________________________________________________________________________________
Looking for last minute shopping deals?
Find them fast with Yahoo! Search. http://tools.search.yahoo.com/newsearch/category.php?category=shopping
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden