15
What cause this exception, I can't manage to find out.
Request processing failed; nested exception is javax.persistence.PersistenceException: org.hibernate.PropertyAccessException: Exception occurred inside setter of my.Class
Root cause:
javax.persistence.PersistenceException: org.hibernate.PropertyAccessException: Exception occurred inside setter of my.Class
Code:
@ManyToMany(fetch = FetchType.EAGER)
public void setTags(Set<Tags> tags) {
this.tags.clear();
for (Tag tag : tags) {
addTag(tag);
}
}
public boolean addTag(final Tag tag) {
if (tags.contains(tag)) {
return false;
}
return tags.add(tag);
}
I initalize tags in the constructor:
tags = new HashSet<Tag>();
EDIT
Exception from logging in setter method:
ax.persistence.PersistenceException: org.hibernate.PropertyAccessException: Exception occurred inside setter of com.mycompany.domain.Book.Tags
at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1387) ~[hibernate-entitymanager-4.2.0.Final.jar:4.2.0.Final]
at org.hibernate.ejb.AbstractEntityManagerImpl.find(AbstractEntityManagerImpl.java:838) ~[hibernate-entitymanager-4.2.0.Final.jar:4.2.0.Final]
at org.hibernate.ejb.AbstractEntityManagerImpl.find(AbstractEntityManagerImpl.java:781) ~[hibernate-entitymanager-4.2.0.Final.jar:4.2.0.Final]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:201304051638]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[na:201304051638]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:201304051638]
at java.lang.reflect.Method.invoke(Method.java:601) ~[na:1.7.0]
at org.springframework.orm.jpa.SharedEntityManagerCreator$SharedEntityManagerInvocationHandler.invoke(