The best way to create a test case for Hibernate is to fork the repository and create the test based on some existing one, as explained in this article. You shouldn’t use frameworks like Spring or Lombok, as they could interfere with the replicating test case. Once you do that, you should create a new Jira issue, as this one is closed and doesn’t use the same mappings as your own. Also, your mappings are wrong. The entity you called Child is actually the parent entity. The entity you called Parent is the one that contains the FK, so it should be the child instead. And, cascading from the child side to the parent is also a mistake. How can a child exist prior to its parent? And, you are better off using @MapsId instead of @PrimaryKeyJoinColumn. Check out this article for more details. Now, I’m no longer working on the Hibernate project, so once you add the test case as a Pull Request, someone from the team should review it. |