In fact to be more precise the real problem is rather with the use of mappedBy (normal use).
And there it tells us the collection foreign key mapping has wrong number of column.
Logical because the primary key of Agent consists only of an ID column while the foreign key of two columns ID + ROLE
Caused by: org.hibernate.MappingException: collection foreign key mapping has wrong number of columns: org.hibernate.bugs.entity.Affaire.taches type: long
at org.hibernate.mapping.Collection.validate(Collection.java:379)
at org.hibernate.mapping.Set.validate(Set.java:51)
at org.hibernate.boot.internal.MetadataImpl.validate(MetadataImpl.java:380)
at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:301)
at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:415)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:1425)
Do you know if this topic will be taken into consideration?
Depends what you mean by “taken into consideration”. The Hibernate ORM team is willing to review and work through a PR contributed by the community, but we do not actively work on this or have plans to do so in the future.
If it was on the to-do list or not at all ^^.
And also, if it’s expected to use ‘mappedBy’ with an ‘@Any’ soon.
If yes, I can look into it with my knowledge to see if I can solve the issue, but I was worried it might be outside my expertise.
However, I can give it a try and provide feedback on this post if that’s okay with you
I would have liked to know if this possibility of being able to use mappedBy with an @Any was on the list of planned features? Because on our side, we have more than a hundred cases like this.
What surprises me is that we seem to be the only ones, or few, asking for it.