The difference between a one to many relationship and a one to many bidirectional relationship (Google App Engine Java Api)

What is the difference between owning from one to many relationships and from one to many bidirectional relationships? I read the article below, but I don’t understand this. Article

+5
source share
2 answers

Own one-way bidirectional relationships simply mean that the children have a reference to the parent. For example, the child below can access the parent through persistentUser. If persistentUser did not exist in the PersistentLogin class, then it would not be bidirectional.

-- (PersistentUser.java - ):

@OneToMany(mappedBy = "persistentUser", cascade = CascadeType.ALL)
private Collection<PersistentLogin> persistentLogins;

-- (PersistentLogin.java - ):

@ManyToOne(fetch = FetchType.LAZY)
private PersistentUser persistentUser;
+5

, . Named FootBallTeam teamname. -

   FootBallTeam ft = new FootBallTeam();
    ft.setteamname("Barcelona");

3 , , . , , ,

   ft.setteamname("Real Madrid");

.

Messi.setteamname("Real Madrid")
Xavi.setteamname("Real Madrid")
Iniesta.setteamname("Real Madrid")
0

All Articles