Quarkus: Support hibernate.max_fetch_depth property

Created on 21 Aug 2020  路  7Comments  路  Source: quarkusio/quarkus

Hibernate has a configuration option called max_fetch_depth (see AvailableSettings.MAX_FETCH_DEPTH and https://docs.jboss.org/hibernate/stable/core.old/reference/en/html/configuration-optional.html). This option is currently not "exposed" by Quarkus as a config property and can thus not be set in application.properties and only through persistence.xml.

I think it would make sense if Quarkus could provide a corresponding quarkus-hibernate-orm.max-fetch-depth property. (Or should it be quarkus-hibernate-orm.query.max-fetch-depth? If yes, should quarkus.hibernate-orm.batch-fetch-size be moved?)

arehibernate-orm arepersistence kinenhancement

Most helpful comment

Suggestion: add a new category hibernate-orm.fetch for stuff like this and the batch fetch batch size.

All 7 comments

/cc @gsmet, @Sanne

hi @knutwannheden ! yes good point, we probably should expose this one. Do you think you could help with a PR?

I like the idea of grouping it under query., and moving batch-fetch-size there too, but in such case let's be careful and deprecate the old name.

I will try to create a PR for max-fetch-depth then and create a separate issue for the moving of batch-fetch-size.

Actually, I am now not so sure it is a good idea to add .query to the name. This was probably copied from Hibernate, where some properties also have that name and max-fetch-depth isn't one of them. So, for consistency, it probably makes more sense to drop the .query part. Thoughts?

Actually max_fetch_depth, at least historically, would not have affected HQL and SQL queries, but only find() and lazy fetching.

In a query you have to specify fetching explicitly.

@gavinking of course you're right, nevertheless I was still liking the idea to group all tuning properties which affect fetch/load/query. The alternative is to leave these "rootless", or suggest a better name?

@knutwannheden in this context I'm not too attached to "consistency", because Quarkus often uses different defaults than Hibernate ORM, or offers different options or somtimes with slightly different semantics: in some cases we _intentionally_ preferred different names or terminology to avoid confusion.
I hope that - generally - people will clearly see and understand that they can't copy an existing hibernate.properties into a Quarkus configuration file.

The general intent is to favour new applications over porting of legacy applications; also it's an opportunity for us to review how we think the ORM configuration could be modernized, w/o imposing breaking changes to all Hibernate ORM users. This is also the reason why we preferred to expose only a few properties, and re-introduce some gradually - and only after real demand ;)

Suggestion: add a new category hibernate-orm.fetch for stuff like this and the batch fetch batch size.

Was this page helpful?
0 / 5 - 0 ratings