[Fixes] Table 19. Declaring entity associations - Documentation

URL: https://docs.jboss.org/hibernate/orm/6.5/introduction/html_single/Hibernate_Introduction.html#entities

@ManyToMany
Declare either side of a one-to-one association?

@ManyToMany
Declare either side of a --> [many-to-many] association?
This commit is contained in:
Leonardo Nogueira Meireles 2024-06-08 11:43:56 -03:00 committed by Gavin King
parent 8100f92265
commit f86bdf08c1
1 changed files with 2 additions and 2 deletions

View File

@ -1499,7 +1499,7 @@ Let's pause to remember the annotations we've met so far.
| `@ManyToOne` | Declare the single-valued side of a many-to-one association (the owning side) | ✔
| `@OneToMany` | Declare the many-valued side of a many-to-one association (the unowned side) | ✔
| `@ManyToMany` | Declare either side of a one-to-one association | ✔
| `@ManyToMany` | Declare either side of a many-to-many association | ✔
| `@OneToOne` | Declare either side of a one-to-one association | ✔
| `@MapsId` | Declare that the owning side of a `@OneToOne` association maps the primary key column | ✔
|===
@ -1559,4 +1559,4 @@ class Book {
That said, an implementation of `equals()` and `hashCode()` based on the generated identifier of the entity can work _if you're careful_.
CAUTION: Your implementation of `equals()` must be written to accommodate the possibility that the object passed to the `equals()` might be a <<proxies-and-lazy-fetching,proxy>>.
Therefore, you should use `instanceof`, not `getClass()` to check the type of the argument, and should access fields of the passed entity via its accessor methods.
Therefore, you should use `instanceof`, not `getClass()` to check the type of the argument, and should access fields of the passed entity via its accessor methods.