Details
-
Type:
New Feature
-
Status:
Open
-
Priority:
Critical
-
Resolution: Unresolved
-
Affects Version/s: 1.2-M4
-
Fix Version/s: None
-
Component/s: Persistence
-
Labels:None
Description
Modifying GORMSessionFactoryDefinitionParser.java by
adding the following to private ClassPathBeanDefinitionScanner configureScanner does not due the trick.
// support for JPA Entity class scanner.addIncludeFilter(new AnnotationTypeFilter(javax.persistence.Entity.class));
I get the following exception when trying to add the com.grailstest.Animal @Entity class:
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.grailstest.AnimalValidator': Error sett
ing property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are:
PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'domainClass' threw exception; nested exception is java.lang.NullPointe
rException
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1335)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1061)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:511)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:450)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:289)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:286)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:188)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:543)
Destroying 1 processes
Destroying process.. at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:730)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:387)
Destroyed 1 processes at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:84)
at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:1)
at org.springframework.test.context.TestContext.loadApplicationContext(TestContext.java:280)
at org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:304)
... 28 more
Caused by: org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are:
PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'domainClass' threw exception; nested exception is java.lang.NullPointe
rException
at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:104)
at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:60)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1332)
... 42 more
Apparently, for every JPA @Entity the appication is looking for a
{CLASS_NAME}Validator for that entity.
It would also be nice if it could support @Validateable or static constraints like a JPA Entity object supports directly in Grails.
Issue Links
- relates to
-
GRAILS-5290
Modify gorm.xsd to support optional config-location and config-class as specified in GORMSessionFactoryDefinitionParser javadoc
-
Note I am assuming I don't need to add config-class="org.codehaus.groovy.grails.orm.hibernate.cfg.GrailsAnnotationConfiguration", because it looks like GORMSessionFactoryDefinitionParser uses that as default.