Skip to content
Advertisement

Tag: hibernate

Not supported for DML operations with JPA update query

This has been asked once before but the solution did not solve the issue. I am creating a JUnit test: The query the above test is calling is: Error: Answer The @Modifying annotation must be placed on the updateMaterialInventory method, along to the @Query annotation, to let Spring-data know that the query is not a query used to select values,

object references an unsaved transient instance – save the transient instance before flushing: com.entity.Role

I’m getting object references an unsaved transient instance – save the transient instance before flushing: com.entity.Role exception while trying to insert some values in table using hibernate related dependencies in pom.xml are Role.java is User.java is I’m using repository as mentioned in this video, are and and InitDbService.java is I have seen this SO Answer, but still getting this error

Hibernate: New Session without dropping the tables

I am new to Hibernate (implementing since yesterday) and i succesfully created a method, that transfers my Customer Objects to the Database. After i quit my application and start it again and create a new session (in an other method) based on my hibernate.cfg.xml file with this setting: It leads to that point, that all relevant tables, created with Hibernate

Spring JPA no transaction is in progress

I am new to Spring and JPA, wasted 5 days and no result with searching internet. I want to save object to SQL SERVER, connection is correct but when I write .flush() I get the exception nested exception is javax.persistence.TransactionRequiredException: no transaction is in progress This is my jpaContext.xml This is my persistence.xml file: This is my Service implementation: And

How to inject multiple JPA EntityManager (persistence units) when using Spring

I need to use one database for queries (non-modifying) and one for commands (modifying). I am using Spring Data JPA, so I have two configuration classes: In my repository I sometimes need to decide with EntityManager to use like so: I am using persistence unit’s name as defined in my persistence.xml: Spring throws org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named ‘persistence.reading’ is defined.

Advertisement