Last active
September 6, 2017 12:44
-
-
Save mirasrael/d8a20fe3840ef98fa3ccbcd1405ab5cd to your computer and use it in GitHub Desktop.
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
package cv.hibernate | |
import groovy.transform.CompileStatic | |
import org.hibernate.engine.spi.SessionImplementor | |
/** | |
* Date: 09/05/2017 | |
* Time: 18:30 | |
*/ | |
@CompileStatic | |
class GormBatchCollectionLoader extends BatchCollectionLoader { | |
static void preloadCollections(List entities, String ... collectionNames) { | |
Class entityClass = getEntityClass(entities) | |
if (entityClass == null) { | |
return | |
} | |
entityClass.getMethod("withSession", Closure).invoke(null, { session -> | |
preloadCollectionsInternal((SessionImplementor) session, entityClass, entities, collectionNames) | |
}) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment