You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by Lawrence Gerstley <la...@gmail.com> on 2009/07/31 07:40:27 UTC

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


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

Posted by Lawrence Gerstley <la...@gmail.com>.
PK Generation Strategy is "Default"--I can't find anywhere else in the
modeler to try to affect this.

On Fri, Jul 31, 2009 at 7:23 AM, Michael Gentry <mg...@masslight.net>wrote:

> If you select ENTRYSTATE (the DbEntity) in Cayenne Modeler and look
> under the Entity tab, what do you see for the Primary Key settings?
>
>
> On Fri, Jul 31, 2009 at 1:40 AM, Lawrence Gerstley<la...@gmail.com>
> wrote:
> > 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
> >
> >
>



-- 
============================
Lawrence Gerstley, Ph.D.
PSMI Consulting

Cel: 415.694-0844

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

Posted by Michael Gentry <mg...@masslight.net>.
If you select ENTRYSTATE (the DbEntity) in Cayenne Modeler and look
under the Entity tab, what do you see for the Primary Key settings?


On Fri, Jul 31, 2009 at 1:40 AM, Lawrence Gerstley<la...@gmail.com> wrote:
> 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
>
>