hibernate - What is the best way to map data of junction table in Java entity? -


I have three tables that present my very simple project.

  make table company (id INT) not original primary key AUTO_INCREMENT, name VARCHAR (250)) Faucet; Create table worker (id INT not original primary key AUTO_INCREMENT, name VARCHAR tap (250)); Make Table Company (Employee) (Company_ID not INT, Employee_ID not INT, Rent_Data Date, Error Zero, Regina_Data DATE DEFUILT Faucet, Foreign Key (company_id) Reference Company (ID), Foreign Key (employee_id) Reference Person (ID);   

and I have Java rendering

  @ entity @Table (name = "employee") public class employee serialjob {@Id @GeneratedValue (strategy = generation) Type AOTO) integer ID; @column (name = "name") string name; @ManyToMany (mapped = "employee") private list & lt; Company & gt; Companies; @Entity @Table (name = "company") operates a public class company serializable {@Id @GeneratedValue (strategy = GenerationType.AUTO) private integer ID; @column (name = "name") private string name; @ManyToMany (fetch = FetchType.EAGER, cascade = CascadeType.ALL) @JoinTable (name = "company_ employee", included column = {@JoinColumn (name = "company_id")}, inverseJoinColumns = {@JoinColumn (name = "employee_id ")}) Private Collections & lt; Employee & gt; Employees;   

I do not know where I can store history data. In the history data, I will have to store fare, agginess will be needed and all the companies of every amplicy must also be stored. So my question is, can I manage such kind of information and what is the best way to store history history? "post-text" itemprop = "text">

There are many relationships with these qualities for many I believe that you can understand how to deal with this one basic example :



Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -