Skip to content
Advertisement

Bind two Entity without intermediate Entity spring data jpa

I have a user table(and entity)

JavaScript

and user groups

JavaScript

group users are stored in bind table

JavaScript

I want to have in my group entity list of userEntity(without bind entity). Any ideas? Of course, I can use @Query annotation, but I have other entities who mapped with group and they will automatic get group entity. Can I override automatical methods?

Advertisement

Answer

You can use @JoinTable and define column mapping with join table in UserGroup Enitity

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement