時々、私はこの警告メッセージが表示されます。休止状態警告(HHH000470)の修正方法は?
aug 09, 2017 3:40:02 AM org.hibernate.collection.internal.AbstractPersistentCollection setCurrentSession WARN: HHH000470: An unexpected session is defined for a collection, but the collection is not connected to that session. A persistent collection may only be associated with one session at a time. Overwriting session. Collection : [royaleserver.database.entity.PlayerEntity.homeChests#1757]
PlayerEntity:
public class PlayerEntity implements Identifiable<Long>, Serializable {
...
@OneToMany(mappedBy = "player")
private Set<HomeChestEntity> homeChests = new HashSet<>();
public Set<HomeChestEntity> getHomeChests() {
return homeChests;
}
public PlayerEntity setHomeChests(Set<HomeChestEntity> homeChests) {
this.homeChests = homeChests;
return this;
}
}
HomeChestEntity:
public class HomeChestEntity implements Serializable {
@Id
@ManyToOne
@PrimaryKeyJoinColumn(name = "player_id", referencedColumnName = "id")
private PlayerEntity player;
...
}
そして、この警告メッセージの後
は、セッションが閉じられています。java.lang.IllegalStateException: Session/EntityManager is closed at org.hibernate.internal.AbstractSharedSessionContract.checkOpen(AbstractSharedSessionContract.java:337) at org.hibernate.engine.spi.SharedSessionContractImplementor.checkOpen(SharedSessionContractImplementor.java:135) at org.hibernate.internal.AbstractSharedSessionContract.checkOpenOrWaitingForAutoClose(AbstractSharedSessionContract.java:343) at org.hibernate.internal.SessionImpl.getPersistenceContext(SessionImpl.java:2275) ...
どうしたのですか?
なぜアンサーフックを削除しましたか? – thst