Skip to content
Advertisement

Exception in thread “main” org.hibernate.AnnotationException: – Use of @OneToMany or @ManyToMany targeting an unmapped class:

Java 11

Try to use Hibernate

Here migration sql:

JavaScript

Here entities:

JavaScript

And one more

JavaScript

And try run like this:

JavaScript

But I get error:

JavaScript

Advertisement

Answer

The problem is in this block:

JavaScript

You either use @Column or a@One/ManyToOne/Many relation. You cannot use both. The first one is for mapping primitive data types. The other one is for entities relations. Remove @Column and you should be good to go.

Update

You added Client as annotated class, but not AddressDataSet. Add it just under the addAnnotatedClass(Client.class):

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement