jpa 多對多對映 記下來 以便查詢

2021-06-10 04:49:01 字數 1930 閱讀 9989

@entity

@table(name = "brands")

public class brand ,

inversejoincolumns = )

private listdealers;

private integer status;

public integer getstatus()

public void setstatus(integer status)

public listgetdealers()

public void setdealers(listdealers)

public int getid()

public void setid(int id)

public string getname()

public void setname(string name)

public string getimgurl()

public void setimgurl(string imgurl)

public string getstyle()

public void setstyle(string style)

public integer getmanufacturerid()

public void setmanufacturerid(integer manufacturerid)

}

@entity

@table(name = "dealers")

public class dealer

public void setstatus(integer status)

private list

brands;

public list

getbrands()

public void setbrands(list

brands)

public int getid()

public void setid(int id)

public string getname()

public void setname(string name)

public string getpassport()

public void setpassport(string passport)

public string getpassword()

public void setpassword(string password)

public string getcontactperson()

public void setcontactperson(string contactperson)

public string getcellphone()

public void setcellphone(string cellphone)

public string getphone()

public void setphone(string phone)

public string getaddress()

public void setaddress(string address)

public listgetmanufacturers()

public void setmanufacturers(listmanufacturers)

public date getupdatedat()

public void setupdatedat(date updatedat)

public listgetfurnitures()

public void setfurnitures(listfurnitures)

}

JPA單向多對多實體對映

知識點梳理 a 註解配置時使用 jointable配置中間表,joincolumns配置當前類對應的主鍵id,inversejoincolumn反向配置對應的表主鍵id b 建表時,中間表配置雙主鍵 雙外來鍵 單向多對多 create table sys role id varchar 64 pri...

jpa多對一對映

1.插入 建乙個部門類dept和乙個員工類emp emp對dept是多對一的關係 因為乙個部門有多個員工,而乙個員工只有乙個部門 emp類中新增乙個dept的屬性 manytoone註解表示了員工和部門是多對一的關係 joincolumn註解的name屬性表示外鍵名 emp表中會多出乙個外來鍵列 多...

JPA 對映雙向多對多關聯關係

不維護關聯關係的一端 entity table name item public class item public void setid integer id public string getitemname public void setitemname string itemname pub...