@JdbcTypeCode on @MapKeyColumn

In one of my hibernate entity I have the following attribute

    @MapKeyColumn(name = "block_id")
    @Column(name = "target_id")
    private Map<UUID, UUID> variantMapping = new HashMap<>();

We store this map as an external table and store the uuid as VARCHAR.

However when using this attribute I have the error Cannot cast String as UUID.

Any idea how I could make this work ? I’m using hibernate 6.2.3

This looks like a bug. Please create an issue in the issue tracker(https://hibernate.atlassian.net) with a test case(hibernate-test-case-templates/JPAUnitTestCase.java at main · hibernate/hibernate-test-case-templates · GitHub) that reproduces the issue.

1 Like