Skip to content

Commit 6f4936c

Browse files
committed
don't enhance the session factory if it doesn't exist
1 parent a01a4fa commit 6f4936c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/groovy/org/codehaus/groovy/grails/plugins/orm/hibernate/HibernatePluginSupport.groovy

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,8 +218,10 @@ Try using Grails' default cache provider: 'org.hibernate.cache.OSCacheProvider'"
218218

219219
static final doWithDynamicMethods = {ApplicationContext ctx ->
220220

221-
SessionFactory sessionFactory = ctx.getBean("sessionFactory")
222-
enhanceSessionFactory(sessionFactory, application, ctx)
221+
if(ctx.containsBean("sessionFactory")) {
222+
SessionFactory sessionFactory = ctx.getBean("sessionFactory")
223+
enhanceSessionFactory(sessionFactory, application, ctx)
224+
}
223225
}
224226

225227
public static void enhanceProxy ( HibernateProxy proxy ) {

0 commit comments

Comments
 (0)