0

I change my connection to tomcat datasource in my springboot app, but after I change my app start to get the lazy load erro:

org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: br.com.lumera.cartoriointeligente.backend.entity.TbMovimentacao.pedidos, could not initialize proxy - no Session
    at org.hibernate.collection.internal.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:587) ~[hibernate-core-5.0.11.Final.jar:5.0.11.Final]
    at org.hibernate.collection.internal.AbstractPersistentCollection.withTemporarySessionIfNeeded(AbstractPersistentCollection.java:204) ~[hibernate-core-5.0.11.Final.jar:5.0.11.Final]
    at org.hibernate.collection.internal.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:566) ~[hibernate-core-5.0.11.Final.jar:5.0.11.Final]

When I develop I don`t get this error because I use the default connection from springboot, but in Prod when I use datasource fail..

anyone know how fix this?

tks

Fabio Ebner
  • 2,613
  • 16
  • 50
  • 77
  • 1
    possible duplicate...http://stackoverflow.com/questions/11746499/solve-failed-to-lazily-initialize-a-collection-of-role-exception – Jason White May 21 '17 at 13:45
  • Not duplicate, when I use normal connection works fine. but with datasource not. I think is another configuration – Fabio Ebner May 21 '17 at 13:52
  • Can you paste `TbMovimentacao` entity class? – harshavmb May 26 '17 at 11:09
  • In my TbMovimentacao I have one with LAZY, but my doubt are why when I use Springboot jpa I dont have this problem and with tomcat datasource I have the problem – Fabio Ebner May 26 '17 at 13:14

0 Answers0