<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <title>Lazy Load of Hibernate doesn't work in Liferay 7.2 DXP</title>
  <link rel="self" href="https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=119702992" />
  <subtitle>Lazy Load of Hibernate doesn't work in Liferay 7.2 DXP</subtitle>
  <id>https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=119702992</id>
  <updated>2026-04-04T16:01:55Z</updated>
  <dc:date>2026-04-04T16:01:55Z</dc:date>
  <entry>
    <title>RE: Lazy Load of Hibernate doesn't work in Liferay 7.2 DXP</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=119712085" />
    <author>
      <name>Syed Nasar</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=119712085</id>
    <updated>2020-08-05T14:23:01Z</updated>
    <published>2020-08-05T14:23:01Z</published>
    <summary type="html">Even in 7.2, we are deploying as a war.&lt;br /&gt;Why difficulty in exposing these kinds of things within OSGi.&lt;br /&gt;And can you provide some examples for implementing Hibernate Lazy load in Liferay 7.2.</summary>
    <dc:creator>Syed Nasar</dc:creator>
    <dc:date>2020-08-05T14:23:01Z</dc:date>
  </entry>
  <entry>
    <title>RE: Lazy Load of Hibernate doesn't work in Liferay 7.2 DXP</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=119706102" />
    <author>
      <name>David H Nebinger</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=119706102</id>
    <updated>2020-08-05T02:34:17Z</updated>
    <published>2020-08-05T02:34:17Z</published>
    <summary type="html">OSGi brings a lot of classloader restrictions and requirements into play. It can be difficult exposing these kinds of things within OSGi.&lt;br /&gt;&lt;br /&gt;In 6.2 you had a portlet war file and your hibernate was isolated within the web application. This happens to be a construct that hibernate knows how to operate within. You&amp;#39;ll have to stick to the same kind of deployment model to get it to work under 7.x.</summary>
    <dc:creator>David H Nebinger</dc:creator>
    <dc:date>2020-08-05T02:34:17Z</dc:date>
  </entry>
  <entry>
    <title>Lazy Load of Hibernate doesn't work in Liferay 7.2 DXP</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=119702991" />
    <author>
      <name>Syed Nasar</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=119702991</id>
    <updated>2020-08-04T15:02:07Z</updated>
    <published>2020-08-04T15:02:07Z</published>
    <summary type="html">&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;We are using hibernate for service interaction. (Not service builder)At one model class,&amp;nbsp; we are using Lazy load as follows:&lt;br&gt;&lt;br&gt;&lt;pre&gt;&lt;code&gt;@OneToOne(orphanRemoval = true, fetch = FetchType.LAZY, cascade = CascadeType.ALL)
@JoinColumn(name = "SCHOOL_ENROLMENTS_ID")
private final SchoolEnrolments enrolments = new SchoolEnrolments();
&lt;/code&gt;&lt;/pre&gt;&lt;br&gt;It was working fine in Liferay 6.2 but after upgrading to 7.2 DXP,&amp;nbsp; It returns the following error while trying to accessing this field.&lt;br&gt;&lt;br&gt;&lt;pre&gt;&lt;code&gt;org.hibernate.LazyInitializationException: could not initialize proxy - no Session
&amp;amp;nbsp;&amp;amp;nbsp; &amp;amp;nbsp;at org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:167)
&amp;amp;nbsp;&amp;amp;nbsp; &amp;amp;nbsp;at org.hibernate.proxy.AbstractLazyInitializer.getImplementation(AbstractLazyInitializer.java:215)
&amp;amp;nbsp;&amp;amp;nbsp; &amp;amp;nbsp;at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:190)
&lt;/code&gt;&lt;/pre&gt;&lt;br&gt;&lt;span style="color: #e83e8c"&gt;&lt;/span&gt;&lt;br&gt;&lt;span style="color: #e83e8c"&gt;&lt;/span&gt;&lt;/body&gt;&lt;/html&gt;</summary>
    <dc:creator>Syed Nasar</dc:creator>
    <dc:date>2020-08-04T15:02:07Z</dc:date>
  </entry>
</feed>
