Hi David,
for P.1: I'm not sure how to help here: Hibernate's responsibility is
to provide a faithful, transactional representation of the data in the
database - having it ignore some portion of existing data based on
some totally arbitrary rule is going to clash with the tool. Could you
be more specific about why some data should not be loaded, and maybe
frame the use case description which we could possibly evolve into a
proposal for an API improvement?
for P.2 : you have lots of options here, however most will need using
the Hibernate API, or hint properties via JPA. One is to open the
Hibernate Session into "read-only" mode. Another option is to set the
Session's flush mode to `FlushMode.MANUAL` (and then not flush). Or
you could clear it just after the query was performed: this would
effectively detach all loaded entities, and therefore we'll also stop
monitoring them for changes, making sure there's nothing to flush at
commit time. For a pure read-only scenario, the optimal solution is to
open the Session in read-only mode.
session.setHibernateFlushMode(FlushMode.MANUAL);
session.setDefaultReadOnly(true);
Query also exposes `setReadOnly`, in case you only want to set to
read-only the results of a specific query.
But I'd love to have more details about why this happens, there might
be an issue with dirty checking; compared to Thorntail it's the same
Hibernate ORM engine, but clearly it's a different version and a
different configuration; in particular a significant difference in
this area is that Quarkus enforces the use of build time enhancement.
P.3 : catching exceptions for flow control wasn't a good idea on
Thorntail either. The right solution is to use filters:
-
https://docs.jboss.org/hibernate/orm/5.4/userguide/html_single/Hibernate_User_Guide.html#pc-filtering
Thanks,
Sanne
> --
> You received this message because you are subscribed to the Google Groups "Quarkus Development mailing list" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
quarkus-dev...@googlegroups.com.
> To view this discussion on the web visit
https://groups.google.com/d/msgid/quarkus-dev/f9393d88-12a7-4f3a-b2bf-946d6f09399fn%40googlegroups.com.