Oracle trying to get key from sequence (DUAL)--how to stop?

From: Lawrence Gerstley (lawger..mail.com)
Date: Fri Jul 31 2009 - 01:40:27 EDT

  • Next message: Michael Gentry: "Re: Oracle trying to get key from sequence (DUAL)--how to stop?"

    Hello,

    I've got a system where I need to populate my primary keys directly
    with GUIDs, rather than letting Cayenne do it. For the most part, this
    is working fine--I've exposed the keys in the Object layer, and set
    them when I create a new object. However, there still seem to be calls
    to an Oracle sequence for a key that I'm setting. That is, I've got:

    ENTITY
            -- EntityCode (PK)
            -- EntryStateID (FK)
    ENTRYSTATE
            -- EntryStateID (PK)

    I create the entity, set the Entity's key, create the EntryState, set
    the EntryState's key, and attach the EntryState to the Entity
    (entity.setToEntryState(entryState). I check all of the values both by
    checking the objects individually, and through reference (e.g.,
    entity.getToEntryState.getEntryStateId()). Regardless, when I go to
    commit the changes consisting of the new objects being added to the
    data context, I get:

    SELECT entryState.nextval FROM DUAL;

    I could create an Oracle sequence, but I don't want this--I want to be
    responsible for the keys myself. Can you help me find where this auto-
    sequence dependency is coming from, and how to stop it? I'd rather it
    just fails than try to get a key through some sequence.

    Thanks,

    Lawrence



    This archive was generated by hypermail 2.0.0 : Fri Jul 31 2009 - 01:41:04 EDT