Re: accessing the primarykey???
Re: accessing the primarykey???
- Subject: Re: accessing the primarykey???
- From: Theodore Petrosky <email@hidden>
- Date: Wed, 14 Jul 2010 05:53:50 -0700 (PDT)
What I wanted was a way to create a qualifier searching for a primaryKey... I am using the primaryKey as the jobNumber so what I ended up with is:
try {
versionQual = Version.VERSION_STATUS.dot(VersionStatus.VERSION_STATUS_TITLE).eq("Billed").and(Version.JOB.eq( (Job) EOUtilities.objectWithPrimaryKeyValue(versionListEC, "Job", Integer.parseInt(jobNumberHolder()))));
} catch (EOObjectNotAvailableException na){
noSuchJobNumber = true;
versionQual = Version.VERSION_STATUS.dot(VersionStatus.VERSION_STATUS_TITLE).eq("Billed");
} catch (NumberFormatException nfe) {
noSuchJobNumber = true;
versionQual = Version.VERSION_STATUS.dot(VersionStatus.VERSION_STATUS_TITLE).eq("Billed");
}
versionList = Version.fetchVersions(versionListEC, versionQual, null);
theVersionListDG.setObjectArray(versionList);
return null;
where I get the primaryKey from jobNumberHolder()....
it works great. I hope it is 'correct'.
Ted
--- On Tue, 7/13/10, Chuck Hill <email@hidden> wrote:
> From: Chuck Hill <email@hidden>
> Subject: Re: accessing the primarykey???
> To: "Lachlan Deck" <email@hidden>
> Cc: "Theodore Petrosky" <email@hidden>, "WebObjects-Dev Mailing List List" <email@hidden>
> Date: Tuesday, July 13, 2010, 11:05 PM
>
> On Jul 13, 2010, at 7:30 PM, Lachlan Deck wrote:
>
> > If you need to append to that qualifier (e.g.,
> isDeleted=false) you can also do:
> >
> > EOEntity eoEntity = EOUtilities.entityNamed(ec,
> Foo.ENTITY_NAME);
> > String pkName =
> eoEntity.primaryKeyAttributeNames().objectAtIndex(0);
> > NSDictionary<String, Object> pk = new
> NSDictionary<String, Object>(Long.valueOf(pkString),
> pkName);
> > EOQualifier pkQualifier =
> eoEntity.qualifierForPrimaryKey(pk);
> > ...
>
> EOQualifier pkQualifier = EOUtilities.
> qualifierForEnterpriseObject(eo.editingContext(), eo);
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden