Greetings to everyone I wonder: when can I use matching to indicate whose relationship is related to a one-on-one relationship or from one to another, or from many to many relationship comparisons with EJB3 (JPA) example I have two tables A and B table A refers to table B so I drew a map for the table?
when I can use matched to indicate whose relationship is one-to-one or one-to-many, or from many to many relationships with EJB3
. mappedBy.
mappedBy
JPA 1.0:
2.1.7 .... . . , 3.2.3.:mappedBy OneToOne, OneToMany ManyToMany . mappedBy , ."--/--" , mappedBy ManyToOne.- , ..
. . . , 3.2.3.
:
OneToOne
OneToMany
ManyToMany
ManyToOne
@Entity public class Player { ... private Team team; @ManyToOne public Team getTeam() { return team; } ... }
@Entity public class Team { ... private Set<Player> players = new HashSet<Player(); public Team() { } @OneToMany(mappedBy = "team") public Set<Player> getPlayers() { return players; } ... }
mappedBy , Player instance team team, team PLAYER. Player .
Player
team
mappedBy , , :
, , , (, , --).
mappedBy , .
, " " A B:
@Entity public class A { @OneToOne @JoinColumn private B b; // Code removed for clarity }
A B. " " . , B A, , , mappedBy:
@Entity public class B { @OneToOne(mappedBy="b") private A a; // Code removed for clarity }
mappedBy " " ", A, " b ".
, , , , . , -, .
Source: https://habr.com/ru/post/1762809/More articles:RESTful resources and orthogonal resource issues - restWhat is the best way to handle XML in Android? - javaWhich control to use to display a larger image on Windows Phone 7 - windows-phone-7Problem with MVC2 DropDownListFor, only displaying class name - c #Qt: QPushButton never appears - c ++IIS restart in file changed - web-configLinux: how to set the time zone of a process? - command-lineThe lack of third-party libraries that prevent the use of Scala? - javahttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1762813/converting-array-of-objects-to-array-of-arrays&usg=ALkJrhjsEqlbuIr7jgKWBHm6CVlEG2l57Qcan you give any asp.net control that doesn't display as html? - asp.netAll Articles