Spring Boot + Spring Security + Hibernate Configuration Example

You may also like...

  • Artur Kovalchuk

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

    • 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

    • 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