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 protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/pccdonl% 40mac.com

This email sent to [EMAIL PROTECTED]

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to