Hi Scott,
well we use following code to access our PK_FIELDS without existence as object
entity:
/** get PK value of Visorgobj
*/
public Object getObjectIdValue()
{
return (getObjectId () != null) ?
getObjectId().getValueForAttribute(ORG_ID_PK_COLUMN) :null;
}
ORG_ID_PK_COLUMN is a defined final in the auto-Class _Visorgobj and can be used
to reference.
Could this be a solution for you?
Ihre Mail vom Fri, 23 Jul 2004 07:00:48 -0400 (Scott McClure [Scott
McClure<scot..martblob.com>]):
> What if I want my ID column to exist in the object entity? I have the
> necessary tables set up (through modeller).
>
> Scott
>
> Dirk Wellmann wrote:
>
> >Hello Scott,
> >
> >to get the ID generated by cayenne, you first have to add a row to the Table
> >"AUTO_PK_SUPPORT". You could create a SQL-Statement with the Modeller
> >Tools->GenerateDatabaseSchema at the bottom you will find a create table and
> >an Insert for your Table. Before you do that, you have to remove the
> >Objectentity for your ID-Column. PK-Columns only have to exist as DB-Entity.
> >..ndrus: Am i right?)
> >
> >Regards
> >
> >Dirk
> >
> >
> >Your Mail from Thu, 22 Jul 2004 14:33:10-0400(Scott McClure[Scott
> >McClure<scot..martblob.com>]):
> >
> >
> >>I would like Cayenne to be responsible for generating the ID. What would
> >need>to be done to accomodate that?
> >>
> >>Scott
> >>
> >>Quoting Eric Schneider <eri..entralparksoftware.com>:
> >>
> >>
> >>
> >>>>I have an ID field that I use outside of Cayenne - the field is used
> >>>>for
> >>>>indexing and such, and therefore needs to be a presistent attribute. I
> >>>>want to
> >>>>know if this is possible without modifying the generated class like
> >>>>described
> >>>>in the documentation. I currently have the id attribute set as the
> >>>>primary key
> >>>>in the modeler and also mapped to the object entity. Will this work?
> >>>>
> >>>>
> >>>If Cayenne isn't responsible for generating the id, it will work fine.
> >>>
> >>>
> >>>
> >>>>Second - if I need to find an object by primary key and I have it
> >>>>mapped to the
> >>>>object entity, is it faster to do a query or to use the new utilities
> >>>>in
> >>>>DataObjectUtils?
> >>>>
> >>>>
> >>>Probably DataObjectUtils is the way to go. Any code you don't have to
> >>>write yourself is always good.
> >>>
> >>>cheers,
> >>>eric
> >>>
> >>>
> >>>On Jul 22, 2004, at 11:32 AM, Scott McClure wrote:
> >>>
> >>>
> >>>
> >>>>There has been lots of conversation on primary keys lately - a couple
> >>>>questions.
> >>>>
> >>>>I have an ID field that I use outside of Cayenne - the field is used
> >>>>for
> >>>>indexing and such, and therefore needs to be a presistent attribute. I
> >>>>want to
> >>>>know if this is possible without modifying the generated class like
> >>>>described
> >>>>in the documentation. I currently have the id attribute set as the
> >>>>primary key
> >>>>in the modeler and also mapped to the object entity. Will this work?
> >>>>
> >>>>Second - if I need to find an object by primary key and I have it
> >>>>mapped to the
> >>>>object entity, is it faster to do a query or to use the new utilities
> >>>>in
> >>>>DataObjectUtils?
> >>>>
> >>>>Thanks!
> >>>>
> >>>>Scott
> >>>>
> >>>>
> >>>>
> >>>
> >>>
> >>
> >>
> >>
> >>
> >>
> >
> >
> >
> >
>
>
>
>
-- Viele GrüßeDirk Wellmann ---------------------------- PD Software GmbH Amalung Straße 16 37688 Beverungen
fon.: +49 5275 98 78 0 fax.: +49 5275 98 78 18 mail: d..dsoft.de www: www.pdsoft.de
This archive was generated by hypermail 2.0.0 : Fri Jul 23 2004 - 09:40:46 EDT