0
我在春天web应用程序和AJAX背后叫下面的异常火灾:杰克逊例外/休眠web应用
com.fasterxml.jackson.databind.JsonMappingException: failed to lazily initialize a collection of role: com.domain.entities.Person.followerd, could not initialize proxy - no Session
父实体:
@Entity
public class Person {
@OneToMany(mappedBy="follower")
@JsonIgnore
private List<FollowerPerson> followerd;
....
@ElementCollection(fetch = FetchType.EAGER)
@CollectionTable(name="phone", [email protected](name="person"))
protected List<Phone> phones;
}
FollowerPerson实体
@Entity
public class FollowerPerson implements Serializable {
@EmbeddedId
private FollowerPk id;
@MapsId("std")
@ManyToOne
private Person std;
@MapsId("follower")
@ManyToOne
private Person follower;
....
}
在我的AppConfig我用这个txManager弹簧+冬眠(JPA为主):
@Bean
public PlatformTransactionManager txManager() {
JpaTransactionManager jpaTransactionManager = new JpaTransactionManager(
getEntityManagerFactoryBean().getObject());
return jpaTransactionManager;
}
当Ajax调用试图识别的findAll DAO方法执行后的名单,看起来所有人
当我与注释取指令= FetchType.EAGER 的其他异常,而不是会出现这个属性的例外发生:
cannot simultaneously fetch multiple bags: [com.domain.entities.Person.followerd, com.domain.entities.Person.phones]
请帮助