Answer the question
In order to leave comments, you need to log in
How to make a connection between employees and orders?
Good afternoon.
There is an Order object. There is an Employee object. Each Order corresponds to several Employees with different logical connections, for example, the author, controller, etc. Each Employee can be linked to several Orders and with different types of communication (in one order he is the author, and in the other he is the executor).
There is also a need to ensure that each order has at least an author, performer, etc.
How can this be implemented in Hibernate 4? As far as I understand, it is possible to make an intermediate entity that will link one object to another and have additional fields. But I don't understand how to guarantee the connection
Answer the question
In order to leave comments, you need to log in
1. How to make a similar connection wrote here: Hibernate many to many with additional attributes?
2.
how to ensure connectionHibernate is an ORM, nothing less, nothing more. It gives convenient object access to the data in the database. But Hibernate is not required to understand your business logic. Well, the relational database level cannot guarantee the presence of many-to-many relationships, it is logical that this cannot be done at the Hibernate level either. Accordingly, the answer to your question is that your business logic should guarantee the existence of a connection .
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question