@Transactionalに変えたらエラーが出てしもうたので、filterを追加
Entity内にあるリストにアクセスしに行ったら
エラーが出るようになった。
これは、Entityの要素がlazyloadになっているからで、
いったん閉じられたDBにアクセスしに行ってるため
org.hibernate.LazyInitializationException: could not initialize proxy - no Session
at org.hibernate.collection.internal.AbstractPersistentCollection.withTemporarySessionIfNeeded(AbstractPersistentCollection.java:180)
at org.hibernate.collection.internal.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:520)
at org.hibernate.collection.internal.AbstractPersistentCollection.read(AbstractPersistentCollection.java:125)
at org.hibernate.collection.internal.PersistentBag.toArray(PersistentBag.java:274)
web.xmlに以下のようなfilterを追加して対応しました。
トランザクションとかは気になるものの、まずはこれでエラー回避しました。
OpenEntityManagerInViewFilter
org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter
entityManagerFactoryBeanName
entityManagerFactory
OpenEntityManagerInViewFilter
/*