This is a typical bidirectional consistency problem. It is well discussed in this link as well as this link.
As per the articles in the previous 2 links you need to fix your setters in both sides of the bidirectional relationship. An example setter for the One side is in this link.
An example setter for the Many side is in this link.
After you correct your setters you want to declare the Entity access type to be “Property”. Best practice to declare “Property” access type is to move ALL the annotations from the member properties to the corresponding getters. A big word of caution is not to mix “Field” and “Property” access types within the entity class otherwise the behavior is undefined by the JSR-317 specifications.
Related Posts:
- How to fix the Hibernate “object references an unsaved transient instance – save the transient instance before flushing” error
- How to fix the Hibernate “object references an unsaved transient instance – save the transient instance before flushing” error
- Error creating bean with name ‘entityManagerFactory’ defined in class path resource : Invocation of init method failed
- org.hibernate.HibernateException: Access to DialectResolutionInfo cannot be null when ‘hibernate.dialect’ not set
- Error creating bean with name ‘entityManagerFactory’ defined in class path resource : Invocation of init method failed
- org.hibernate.HibernateException: Access to DialectResolutionInfo cannot be null when ‘hibernate.dialect’ not set
- org.hibernate.HibernateException: Access to DialectResolutionInfo cannot be null when ‘hibernate.dialect’ not set
- What’s the difference between JPA and Hibernate?
- How to map a composite key with JPA and Hibernate?
- HTTP Status 405 – Request method ‘POST’ not supported (Spring MVC)
- org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘MyController’:
- Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
- What is difference between CrudRepository and JpaRepository interfaces in Spring Data JPA?
- How to fix org.hibernate.LazyInitializationException – could not initialize proxy – no Session
- Unable to create requested service [org.hibernate .engine.jdbc.env.spi.JdbcEnvironment]-MySQL
- Spring Data JPA Update @Query not updating?
- What’s the difference between session.persist() and session.save() in Hibernate?
- What’s the advantage of load() vs get() in Hibernate?
- HTTP Status 405 – Request method ‘POST’ not supported (Spring MVC)
- What are the possible values of the Hibernate hbm2ddl.auto configuration and what do they do
- No Persistence provider for EntityManager named
- Hibernate Error: a different object with the same identifier value was already associated with the session
- How to solve the “failed to lazily initialize a collection of role” Hibernate exception
- hibernate properties not found
- What kind of Java type is “[B”?
- Hibernate – Batch update returned unexpected row count from update: 0 actual row count: 0 expected: 1
- JPA or JDBC, how are they different?
- Hibernate show real SQL
- Spring Boot – Cannot determine embedded database driver class for database type NONE
- Converting double to string
- What is the “continue” keyword and how does it work in Java?
- Java String new line
- What does the protected modifier mean?
- Java default constructor
- What is the meaning of “this” in Java?
- ‘Java’ is not recognized as an internal or external command
- Java: Identifier expected
- How does Java’s PriorityQueue differ from a min-heap?
- java.lang.ClassNotFoundException: com.mysql.jdbc.Driver in Eclipse
- Java split string to array [duplicate]
- How to split a String by space
- Java compile error: “reached end of file while parsing }”
- Double % formatting question for printf in Java
- in java what does the @ symbol mean?
- How to call a method in another class in Java?
- unreported exception java.io.FileNotFoundException; must be caught or declared to be thrown
- Java, “Variable name” cannot be resolved to a variable
- How to convert a Binary String to a base 10 integer in Java
- Java Method Stubs
- How to import a .cer certificate into a java keystore?
- Exception in thread “main” java.lang.ArrayIndexOutOfBoundsException: 0 error in Java
- How can I represent a range in Java?
- How does spring.jpa.hibernate.ddl-auto property exactly work in Spring?
- How to solve error: ‘;’ expected in Java?
- Making a Java Makefile
- Censored Words Condition
- method in class cannot be applied to given types
- unused import statement for used ones in IntelliJ IDEA
- Unsigned long in Java
- How can I fix ‘android.os.NetworkOnMainThreadException’?
- Eclipse does not start when I run the exe?
- How to print to the console in Android Studio?
- java.lang.NumberFormatException: null i
- How do you #include files in java?
- How to use Java in Visual Studio 2017
- List of Arrays in Java
- Extending from two classes
- Cannot make a static reference to the non-static method fxn(int) from the type Two
- What is causing this Java “Cannot find symbol” error?
- What does equals(Object obj) do?
- How do I make the method return type generic?
- keytool error bash: keytool: command not found
- Java Error: The constructor is undefined
- Java Embedding Into HTML
- Why it is mandatory to use “throws IOException”
- Terminating a Java Program
- How to add an image to a JPanel?
- How to create JSON Object using String?
- How to repaint a JPanel after have drawn on it?
- Sort ArrayList of custom Objects by property
- Java better way to delete file if exists
- How to send HTTP request in java? [duplicate]
- Best way to represent a fraction in Java?
- java IO Exception: Stream Closed
- Can a normal Class implement multiple interfaces?
- Node cannot be resolved to a type
- E/AndroidRuntime﹕ FATAL EXCEPTION: main
- Big Oh for (n log n)
- How to programmatically close a JFrame
- Playing .mp3 and .wav in Java?
- Difference between jar and war in Java
- Adding image to JFrame
- Java Fraction Calculator
- How to convert a date to milliseconds
- Eclipse IDE – Error: Build path specifies execution environment Java SE 1.7
- How do I join two lists in Java?
- How to insert multiple tabs string in java?
- model.addAttribute() parameters
- StringFormat for Java Boolean Operator
- JOptionPane Yes or No window