I have an entity named Attendance that has an and emebedid AttendacneId that has two columns lectureId (string) and studenId(UUID). The attendance entity also has other properties as well containing a ManyToOne relationship with student and lecture enity using the @MapsId on them. The student extends user entity where the id resides. now when I try to save anything I get this error.
https://stackoverflow.com/questions/54778309/hibernate-embededid-containing-a-foreign-key-of-an-entity-with-inheritance -> it has a little bit more information.
https://github.com/sukhvir41/hibernate-test-case-templates my entities are in hibernate-5
I already told you on Stack Overflow what you needed to do.
So, I didn’t say you should remove any dependency. I said you should remove the unneeded entities and provide the missing dependencies.
When someone asks you for a replicating test case, you should provide one that actually works. Just run a
mvn clean test on the project, and you’ll get something like this:
[ERROR] /d:/Vlad/Work/HHH/hibernate-orm-5/src/test/java/org/hibernate/bugs/UserType.java:[8,14] package lombok does not exist
[ERROR] /d:/Vlad/Work/HHH/hibernate-orm-5/src/test/java/org/hibernate/bugs/User.java:[24,17] duplicate class: entities.User
[ERROR] /d:/Vlad/Work/HHH/hibernate-orm-5/src/test/java/org/hibernate/bugs/ORMStandaloneTestCase.java:[36,36] cannot access org.hibernate.bugs.User
When you manage to make it work, I will take a look at it.
The only actual dependency I had was lombok other than that there calls to my class only so I just removed that. I have tested it and was able to reproduce it. So when you get the time have a look at it. Thank you.
the classes are in hibernate-orm-5
Student does not have an
@Id so this is not a valid mapping.
You need to read the Hibernate User Guide for more details about how you should map a JPA entity.
The student is getting it’s Id from the user class as it extends it. So how will add @id annotation to the student class as each class can only have one and the student is getting it through inheritance
It might be a bug. You need to open a Jira issue and attach your test case. Now, if this is urgent for you, you should try and figure out a fix for it. When you are done with the fix proposal, open a new Pull Request and we will investigate it.
Looking forward to getting your fix.
Any specific steps or documentation to create a jira ticket.
Use Jira and attach your test case.
I’m having the same issue. Any news on this?
Since I’m not working for Red Hat, I have no idea what is the status of that issue.
You should try fixing it and sending a Pull Request. Usually, Pull Requests have a higher priority than any of the thousand of issues that are in Open state.