An error is reported when using hibernate
java.lang.StackOverflowError: null
The stack of the current thread is full
java.lang.StackOverflowError: null at java.util.AbstractCollection.toString(AbstractCollection.java:454) ~[?:1.8.0_111] at org.hibernate.collection.internal.PersistentBag.toString(PersistentBag.java:538) ~[hibernate-core-5.3.7.Final.jar:5.3.7.Final] at java.lang.String.valueOf(String.java:2994) ~[?:1.8.0_111] at java.lang.StringBuilder.append(StringBuilder.java:131) ~[?:1.8.0_111] at com.crhms.seabow.model.User.toString(User.java:12) ~[classes/:?] at java.lang.String.valueOf(String.java:2994) ~[?:1.8.0_111] at java.lang.StringBuilder.append(StringBuilder.java:131) ~[?:1.8.0_111] at com.crhms.seabow.model.Role.toString(Role.java:12) ~[classes/:?] at java.lang.String.valueOf(String.java:2994) ~[?:1.8.0_111] at java.lang.StringBuilder.append(StringBuilder.java:131) ~[?:1.8.0_111] at java.util.AbstractCollection.toString(AbstractCollection.java:462) ~[?:1.8.0_111] at org.hibernate.collection.internal.PersistentBag.toString(PersistentBag.java:538) ~[hibernate-core-5.3.7.Final.jar:5.3.7.Final] at java.lang.String.valueOf(String.java:2994) ~[?:1.8.0_111] at java.lang.StringBuilder.append(StringBuilder.java:131) ~[?:1.8.0_111] at com.crhms.seabow.model.User.toString(User.java:12) ~[classes/:?] at java.lang.String.valueOf(String.java:2994) ~[?:1.8.0_111] at java.lang.StringBuilder.append(StringBuilder.java:131) ~[?:1.8.0_111] at com.crhms.seabow.model.Role.toString(Role.java:12) ~[classes/:?] at java.lang.String.valueOf(String.java:2994) ~[?:1.8.0_111]
After checking the reason, it should appear on the toString method of the entity. If there is an associated attribute (1 to many, etc.), it cannot be added to the toString method. Otherwise, if it appears, you print me, I print you, and keep typing
Although the toString method is not written in my code, our Lombok data annotation , which comes with toString, can only rewrite the toString method and overwrite the toString method of Lombok
Problem solving
Similar Posts:
- [Solved] java.lang.OutOfMemoryError: GC overhead limit exceeded
- Transcoding of system.web.httputility.urlencode in C #
- [Solved] org.hibernate.AnnotationException: No identifier specified for entity: com.example1.demo1.Entity….
- Analysis and solution of could not initialize proxy – no session exception in JPA
- [Solved] Java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.Double
- [Solved] org.hibernate.hql.internal.ast.QuerySyntaxException: persons is not mapped…
- [Solved] org.hibernate.hql.internal.ast.QuerySyntaxException: persons is not mapped…
- [Solved] org.hibernate.MappingException: Unknown entity
- [Solved] org.hibernate.exception.SQLGrammarException: could not execute statement at…
- How to Solve Java.sql.sqlexception: ora-02289: sequence does not exist