in Technology by

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

Please log in or register to answer this question.

1 Answer

0 votes
by

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

...