Thank you for the fast response! 👍 I use an H2 database in my reproducer, but you are right. When adding
in the application.properties file in order to deactive the batch loading (as a workaround), the error does not appear anymore. But then the problem is, that now the relation objects are not loaded at all. When I access the getter method of the relation the select query is executed, but I don’t get any result. The query
When I select the entities directly, it works as expected. So I assume, that the user type in general works. Example query (for my reproducer)
public void findEntityAByField() {
final var qlString = "SELECT a FROM " + EntityA.class.getName() + " a WHERE a.id = :idField";
final var query = em.createQuery(qlString, EntityA.class);
query.setParameter("idField", new StringWrapper("ID_A_001"));
final var resultList = query.getResultList();
assertEquals(1, resultList.size());
}
The query looks like this
Here I get the entity as expected. As I said, because of this I think the user type works in general. I created a new reproducer for this: https://github.com/timonzi/hibernate-user-type-for-relation-disabled-fetch Am I missing something or is this (another) bug? |