The problem is obvious if you take a look on the database tables and the log message:
- In the
tArtikelSonderpreis
table, thekArtikel
column type is INT - In the
tartikel
table, thekArtikel
column type is BIGINT
Hence, the log message:
Exception in thread "main" java.lang.IllegalArgumentException: org.hibernate.TypeMismatchException: Provided id of the wrong type for class entities.artikel.TArtikelSonderpreisEntity. Expected: class java.lang.Integer, got class java.lang.Long
If you want to see how to map a @OneToOne
association when the PK is shared, you can check out this article.