Spring Boot + Spring Security + Hibernate Configuration Example

You may also like...

Subscribe
Notify of
guest
4 Comments
Oldest
Newest
Inline Feedbacks
View all comments
Artur Kovalchuk
Artur Kovalchuk
November 15, 2017 12:23

Hi, can you tell me about how add to new User() exist role?
What to do if role exist in DB?

Memorynotfound.com
Memorynotfound.com
November 15, 2017 12:47

You need to make sure your cascading is handled correctly.
This can be configured using the @ManyToMany annotation using the cascade property.
In your situation you’re probably saving a detached entity.
You can merge your entity by using ‘cascade= {CascadeType.MERGE, CascadeType.PERSIST}’

Hope this helps you,
Cheers

Memorynotfound.com
Memorynotfound.com
November 15, 2017 12:47

You need to make sure your cascading is handled correctly.
This can be configured using the @ManyToMany annotation using the cascade property.
In your situation you’re probably saving a detached entity.
You can merge your entity by using ‘cascade= {CascadeType.MERGE, CascadeType.PERSIST}’

Hope this helps you,
Cheers

Manuel Silva
Manuel Silva
January 3, 2018 15:22

:)

4
0
Would love your thoughts, please comment.x
()
x