Re: to-many relationship where I don't want most of the items
Michael Gentry <[email protected]> Sun, 21 Jun 2026 17:25:18 -0400
| Newsgroups | gmane.comp.java.cayenne.user |
|---|---|
| Message-ID | <CAOy5kzN5VYVa_iMbkbn8NwGAGY9Z5w-WrZULng5CeM3HZV0chQ@mail.gmail.com> |
--000000000000c6f57b0654ca2baa Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Robert, Just curious where your non-persisted DataMarkerEntry objects are lying around. I'm assuming you haven't added them to your dataMarkerEntries relationship yet. Thanks, mrg On Sun, Jun 21, 2026 at 11:25=E2=80=AFAM Robert A. Decker <decker@robdecker= .com> wrote: > 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. > > 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: > > ObjectSelect<DataMarkerEntry> query =3D > ObjectSelect.query(DataMarkerEntry.class) > .where(DataMarkerEntry.IS_VISIBLE.isTrue()) > .... > > 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? > > Is there a way for me in visibleDataMarkerEntries to also include > non-persisted data marker entries off of my personr instance? > > Rob > > --000000000000c6f57b0654ca2baa--