in Technology by (1.8m points)

Explain annotation in EJB to do the database entity relationships/mappings.

1 Answer

0 votes
by (1.8m points)

EJB 3.0 provides option to define database entity relationships/mappings like one to one, one to many, many to one and many to many relationships. Following are the relevant annotations:

  • OneToOne - Objects are having one to one relationship. For example, a passenger can travel using a single ticket at time.

  • OneToMany - Objects are having one to many relationship. For example, a father can have multiple kids.

  • ManyToOne - Objects are having many to one relationship. For examples, multiple kids having a single mother.

  • ManyToMany - Objects are having many to many relationship. For examples, a book can have mutiple authors and a author can write multiple books.

Related questions

0 votes
asked Nov 7, 2020 in Technology by JackTerrance (1.8m points)