H
H
have_a_questions2016-04-29 19:59:40
Hibernate
have_a_questions, 2016-04-29 19:59:40

Why do we need bidirectional communication in hibernate?

Please explain why bidirectional communication is needed in hibernet, what is its role, when to use it and why is it better than unidirectional

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Kosarev, 2016-05-11
@have_a_questions

Example. There are 2 classes: user and comments:

class User {
    int id;
    String name;
    List<Comment> comments;
    // get/set-методы
}

class Comment {
    int id;
    String content;
    User user;
    // get/set-методы
}

In bidirectional communication, we can get information about the user by accessing the comment object:
But we can also get information about the user's comments:
I.e. the meaning of bidirectional communication is the ability to access related objects in any direction. Although you need to work with this feature carefully, because. one query can lead to the selection of a large amount of extra data.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question