Migrating a Spring Boot app from Boot 2.7.x to 3.2.3, and Hibernate 6. Lots of existing mapped entities that work until moving to Hibernate 6.
I'm getting the annoyingly vague JdbcTypeRecommendationException "Could not determine recommended JdbcType for Java type...", but I'm having trouble tracking down exactly what reference/relationship is causing it.
I may have narrowed it down by some trial-and-error removing of references. I started with an entity and @Embeddable class like this:
@Entity(name = "JobGroup")
public class JobGroupEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private long id;
@ElementCollection
private List<JobReference> jobs = new ArrayList<>();
}
@Embeddable
public class JobReference {
private String jobId;
@Transient
private JobGroupEntity jobGroup;
}
With that, I get the JdbcTypeRecommendationException naming JobGroupEntity. However, if I remove the private JobGroupEntity jobGroup, that exception goes away. It's almost like Hibernate is ignoring the @Transient annotation on that field and still trying to map it. Just for kicks I removed @Transient and it behaved exactly the same (throws the exception).
Based on some reading, I tried adding a @JdbcTypeCode to the jobGroup field, but that didn't help at all.
At this point I'm not even certain that it's the back-reference in JobReference that's actually causing the mapping exception. But the fact that removing that field avoids the exception is pretty strong evidence.
I don't know where to go from here, either to resolve the problem or even know if I'm barking up the wrong or right tree. Any help is appreciated.
Addendum: I'm not really looking for suggestions to change the mapping in significant ways (for example, make JobReference an entity and map it with @OneToMany from JobGroupEntity). I'd like to understand what Hibernate 6 is really complaining about and why it worked in Hibernate 5.x. I might end up altering the mapping in significant ways, but that's my last resort.