forked from sakaiproject/sakai
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SAK-40235 Forums correct issues with EntityManager changes (sakaiproj…
- Loading branch information
Showing
14 changed files
with
108 additions
and
103 deletions.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
kernel/kernel-private/src/main/java/org/sakaiproject/hibernate/HibernateUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package org.sakaiproject.hibernate; | ||
|
||
import org.hibernate.proxy.HibernateProxy; | ||
import org.hibernate.proxy.LazyInitializer; | ||
|
||
public class HibernateUtils { | ||
/** | ||
* THIS CAN BE REMOVED WHEN SAKAI IS ON HIBERNATE >= 5.2.10 | ||
* | ||
* Unproxies a {@link HibernateProxy}. If the proxy is uninitialized, it automatically triggers an initialization. | ||
* In case the supplied object is null or not a proxy, the object will be returned as-is. | ||
* | ||
* @param proxy the {@link HibernateProxy} to be unproxied | ||
* @return the proxy's underlying implementation object, or the supplied object otherwise | ||
*/ | ||
public static Object unproxy(Object proxy) { | ||
if ( proxy instanceof HibernateProxy ) { | ||
HibernateProxy hibernateProxy = (HibernateProxy) proxy; | ||
LazyInitializer initializer = hibernateProxy.getHibernateLazyInitializer(); | ||
return initializer.getImplementation(); | ||
} else { | ||
return proxy; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.