Re: to-many relationship where I don't want most of the items

"Robert A. Decker" <[email protected]> Sun, 21 Jun 2026 23:38:50 +0200
Newsgroups gmane.comp.java.cayenne.user
Message-ID <[email protected]>
Yes I added them to the relationship - I just assume that if I iterate throu=
gh the data markers on the relationship including the new ones it'll hit the=
 database a bunch, loading in the faults as I look for isVisible=3Dtrue

I'm porting this from WebObjects and looking at the old code they passed the=
 new data markers in and added them to the return list pulled from the datab=
ase.=20

I was wondering if there's a way to get, for example, non-persisted entries o=
f a certain type. I'll look at the api.

If I have to I'll just pull them all out of the database and filter them. Th=
ere's only a small number of users with hundreds of data markers - most peop=
le only have a few.=20

Rob

Sent from my iPhone

> On Jun 21, 2026, at 23:26, Michael Gentry <[email protected]> wrote:
>=20
> =EF=BB=BFHi Robert,
>=20
> Just curious where your non-persisted DataMarkerEntry objects are lying
> around. I'm assuming you haven't added them to your dataMarkerEntries
> relationship yet.
>=20
> Thanks,
> mrg
>=20
>=20
>> On Sun, Jun 21, 2026 at 11:25=E2=80=AFAM Robert A. Decker <decker@robdeck=
er.com>
>> wrote:
>>=20
>> I have a to-many relationship where I really only want to pull out a few
>> out of hundreds. In this case, it's those with is_visible set to true. I
>> never actually work with them when is_visible is false, but I can't delet=
e
>> them either because they audit changes.
>>=20
>> person.dataMarkerEntries - this is modelled in the modeller and pulls all=

>> data marker entries from the database. I don't want this.
>> person.visibleDataMarkerEntries  - this is my method and it has a query
>> that only pulls out visible data marker entries from the database:
>>=20
>> ObjectSelect<DataMarkerEntry> query =3D
>> ObjectSelect.query(DataMarkerEntry.class)
>> .where(DataMarkerEntry.IS_VISIBLE.isTrue())
>> ....
>>=20
>> However, the visibleDataMarkerEntries won't include non-persisted (new)
>> data marker entries. But if I call dataMarkerEntries to see the
>> non-persisted data marker entries then will it pull all of them out of th=
e
>> database too?
>>=20
>> Is there a way for me in visibleDataMarkerEntries to also include
>> non-persisted data marker entries off of my personr instance?
>>=20
>> Rob
>>=20
>>=20