Metamodel generation fails on maps with a nested map as value

I have an entity that contains the following type:

private @Valid @ElementCollection @JdbcTypeCode(Types.LONGVARBINARY) Map<String, Map<String, String>> parameters = new HashMap<>();

Metamodel generation using hibernate-jpamodelgen 6.4.0.Final fails with the following error message:

[ERROR] Error generating JPA metamodel: Range [14, -1) out of bounds for length 30

There’s already an issue for that (HHH-17514), and I investigated some time to find the root cause for this and finally created a PR with a possible solution. I don’t know if you have already seen that, so I kindly ask someone to have a look into this PR and give some feedback; whethere it’s “good enough”, meets, say, quality criteria, whatever.
The change itself is quite simple, only a few lines in one single method; the description OTOH is much longer :wink:

PS: 6.4.1 shouldn’t make a difference because the class causing the bug hasn’t change.

Thanks for taking the time to create a Jira and PR. We will look into it as soon as we have time.

1 Like