This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma 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.