Perhaps it is worth wading into this one more time. Using database
generated unique numbers (a.k.a. sequences) is not a problem. As
Benjamin points out below, it is just a matter of some code in the
plugin or even in your app as a delegate method to one of
the EOAccess
classed (I forget which off the top of my head and am too
lazy to look
it up).
Another way that databases generate the primary key is what is often
referred to as an identity column. The values in this column are
filled in by the database when the row is inserted. The method of
primary key generation can NOT be used with WO, or any other
environment that does not use some proprietary database
access method.
If you think about it you will quickly see why it won't work.
You have
some data, but no primary key. You insert it, and the PK is
created by
the database and added to the data. But _you_ are never told
what the
PK is. SQL INSERT only returns a success or failure code, not a copy
of the inserted data. So now you have the data, but not the primary
key (which you have no way of knowing) and the database has the same
data _and_ the primary key. Now, how are you going to update that
exact row if you don't know the PK? You could the row where all the
other values are the same, but there is no guarantee that
this defines
a unique row. In many, many cases it does not define a
unique row, it
defines a set of rows. How are you going to know which one
the the one
you just inserted? In a nutshell, you can't.
Your only hope for using this with WO is to:
1. Somehow force it to not generate the PK and use null as the insert
value. If the database takes 0 as null, then this is easy
2. After insertion _immediately_ tell the ec to forget the
object (not
invalidate, forget).
3. The user will then have to somehow fetch some data that includes
this new object.
Me, I'd stay far away from that.
Chuck
On Nov 19, 2004, at 10:58 AM, Benjamin J Doherty wrote:
On Nov 19, 2004, at 3:33 AM, Sako! wrote:
if you read my first or second post, you will mention i use MS-SQL.
and tipically Apple talks about all the world ECCEPT MS-SQL.
"Apple hates Microsoft" why do i wonder?
Mention this sentence in the site:
" It doesn't work if the database includes rows that are
inserted by
non-Enterprise Objects applications."
so what the hell do i have as a solution then? non.
this sentence tells me i have to forget the PK feature in EOF.
Ok fine. my first question was and still: how can i force
EOF to stop
trying to use this week pk feature(s)?
I don't know ANYTHING about MS-SQL, but I assume that like most
databases it has some support for sequences. If you want
to use these
instead of that (agreed) weak EO_PK_TABLE, just subclass the MS-SQL
adapter, rework the code from the PostgresqlPlugIn from
Project Wonder
(which uses sequences to generate primary keys), and voilà sommes
nous.
But I wasn't following the whole discussion, so I admit I
may not be
on the nose here.
Benjamin J Doherty
sole proprietor
!&# Group
www.bangpound.org
+1-773-934-4236
--
Practical WebObjects - a book for intermediate WebObjects developers
who want to increase their overall knowledge of WebObjects, or those
who are trying to solve specific application development problems.
http://www.global-village.net/products/practical_webobjects
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription: