OK, I *thought* I understood the original question...

On Tue, 2010-04-20 at 07:44 -0700, mabu wrote: 
> i already got the code where the sequence is queried for the current
> inserted value, but how do i set the correct
> sequence name to get the correct value?
> at the moment the sequence name is empty - so the sql breaks ... Can
> you give me a hint please?

mostly because I saw "Oracle" in the subject and thought "I have no idea
about Oracle..."

But now I'm really confused.  I thought you were referring to getting
the primary keys from inserted rows, but you're referring to "sequence
names."  What's a sequence name?  Does this have anything to do with
e.g. Firebird's CREATE SEQUENCE statement?

On Tue, 2010-04-20 at 22:25 -0700, mabu wrote:
> I Added to the DBML definition of the Column:
> Expression="<SEQUENCE_NAME>.CURRVAL"

This just seems terribly wrong.  You're editing the .dbml file to add
a //Column/@Expression attribute that references the sequence name?

I have no idea what this would do.  (I'm not even sure
what //Column/@Expression is supposed to do...)

> The generated Identifier is the unique key and used to associate
> children - do i have to update the children manually before the got
> inserted into the database?

Some code might be needed so I can fully understand your scenario, but
if you have something like:

        Parent p = new Parent () {...};
        db.Parents.InsertOnSubmit(p);
        Child c1 = new Child() { Parent = p };
        Child c2 = new Child() { Parent = p };
        db.Children.InsertOnSubmit(c1);
        db.Children.InsertOnSubmit(c2);
        db.SubmitChanges();

Once the Parent `p` is inserted within `db.SubmitChanges()`, it'll have
a primary key.  The children don't need to be updated, as they're
already referring to the `p` entity, and thus will have the appropriate
foreign key id inserted.

(Note, though, that `db.Parents.InsertOnSubmit()` MUST occur before the
`db.Children.InsertOnSubmit()`, so that the parent exists before
attempting to insert the children, as db.SubmitChanges() does the
inserts/removes in the same order.)

Now, this may have ~nothing to do with your question, as (again) I'm not
entirely sure what your question IS.

Thanks,
 - Jon


-- 
You received this message because you are subscribed to the Google Groups 
"DbLinq" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/dblinq?hl=en.

Reply via email to