Hi everyone, I'm using the experimental Notebook S...
# datascience
d
Hi everyone, I'm using the experimental Notebook Spring Boot starter, so far it's fine, but there are some issues to resolve, the main one is transforming Hibernate entities to DataFrame, because of lazy init. I end up having this exception:
Copy code
listOf(jobRepository.getJobById(12345)).toDataFrame()
Copy code
The problem is found in one of the loaded libraries: check library renderers
org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: data.entity.JobDefinition.jobRuns: could not initialize proxy - no Session
org.jetbrains.kotlinx.jupyter.exceptions.ReplLibraryException: The problem is found in one of the loaded libraries: check library renderers
	at ...
I fixed for now like this:
Copy code
transactionTemplate.execute { status ->
    val element = jobRepository.findById(12345)
    Hibernate.initialize(element.jobDefinition.jobRuns)
    listOf(element).toDataFrame()
};
r
Yep, there's now a known limitation for a transactional context. We're planning to improve it. Your workaround seems to be absolutely correct for now
🔥 1
d
@roman.belov That would be nice, in my project we use Oracle database, and the Dataframe lib. doesn't support OracleDB yet, that's why reading from project repositories direcly using the spring starter is very handy even if it has it's limitations at the moment.
👍 1
These configs help to fetch the lazy data even if no transaction is active:
Copy code
jpa:
  properties:
    hibernate:
      enable_lazy_load_no_trans: true
basically what you need for working in notebooks