I'm quite new to Spring and want to make sure that I am using @JoinTable and @ManuToMany etc correctly.
So I was thinking to test to create and delete some entites from the database and verify that tables such as jointable contains correct data.
My problem is that I don't know how to access this table to verify it's content.
Example:
(Pseudo code)
class Access
Long id
@OneToMany
@JoinTable(
name = "account_role",
joinColumns = @JoinColumn(name = "account_id", referencedColumnName = "id"),
inverseJoinColumns = @JoinColumn(name = "role_id", referencedColumnName = "id"))
Set<Role> roles
class Role
Long id
This should create table named "account_role" that maps the Roles which the Account has. When one account is removed, this table should also be altered. Is it possible to access this table directly (in a convenient way) to verify the content?
I'm using in memory H2 for my tests.
Aucun commentaire:
Enregistrer un commentaire