Reputation: 3
I am using example from https://github.com/mraible/jhipster5-demo. I used Postgresql for dev and pro. Project with entities are generated successfully.
When I create new Blog and saving, i got this error.
Exception in com.asdev.blog.web.rest.BlogResource.createBlog() with cause = 'java.lang.IllegalStateException: org.hibernate.TransientPropertyValueException: object references an unsaved transient instance - save the transient instance before flushing : com.asdev.blog.domain.Blog.user -> com.asdev.blog.domain.User' and exception = 'org.hibernate.TransientPropertyValueException: object references an unsaved transient instance - save the transient instance before flushing : com.asdev.blog.domain.Blog.user -> com.asdev.blog.domain.User; nested exception is java.lang.IllegalStateException: org.hibernate.TransientPropertyValueException: object references an unsaved transient instance - save the transient instance before flushing : com.asdev.blog.domain.Blog.user -> com.asdev.blog.domain.User'
I did with jhipster 4 and worked.
Any suggestions?
Upvotes: 0
Views: 284
Reputation: 1
In this case, it is probably because the value held in the field when saving the Many side(Blog) is in an unmanaged state on JPA. As a countermeasure, I modified Controller, you can solve by retrieving the object on the One side(User) and resetting it to the Many side field.
Upvotes: 0