Look, I understand that this isn’t ideal, and we fixed that in Hibernate 6, but you usually don’t run into this unless you are creating a ton of “unique” queries that trash the query plan cache. So IMO you should size the query plan cache accordingly.