This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
1) I am getting success, when I create any user or event, it successfully updates the table(users,events,Speaker,Participants), But I am facing issues, when I am creating new Event entity
with the users which is already available in the previously created Event. it throws, exceptions.MySQLIntegrityConstraintViolationException, while creating new event.
How I can prevent this situation?
2) Is this design is good, Should I refactored it ? I am using User Entity as Speaker and participant, and thus all creating issues.
Please assist me resolve my issue, if need more details, then I can provide you.
Your usage of the join table is pretty complicated. You could probably simply things by instead mapping an Entity to the join table.
You could also map it instead as a bi-directional ManyToMany, and just enforce the ManyToOne is your get/set methods.
What JPA provider are you using? If you are using EclipseLink, you may be able to use a DescriptorCustomizer to make the ManyToOne readOnly.