I have a problem with spring-data / hibernate and detached entities.
This isn't particularly a kotlin-problem - but since I'm doing the whole project in kotlin, and the example code is kotlin, I'm hoping, that it is still acceptable to post this here.
The gist of it is, that im calling
Copy code
val adminRole = roles.findByName("admin")!!
val adminUser = BackendUser("admin", adminRole
// some more data here
)
users.save(adminUser)
someone on SO pointed out, that i the @transactional annotation possibly isn't picked up on that private method and suggested moving it to its own service - did that, and it appears that has solved the problem.
k
kqr
07/13/2020, 11:19 AM
yeah that was me 🙂
👍 1
kqr
07/13/2020, 11:20 AM
glad it helped
t
thanksforallthefish
07/13/2020, 11:52 AM
you can only annotate public methods in spring in general. just fyi