在我从Git中提取代码并且在Hibernate映射上失败后,我的基于Hibernate的Grails应用程序无法构建。问题是,它适用于我朋友的系统,我不知道它为什么会崩溃。关于此例外,有很多类似的帖子,它们主要与列内的问题有关。这里的区别在于没有像#34;绑定"在我的桌子上。这是异常代码:
Caused by: org.hibernate.MappingException: Could not determine type for: groovy.lang.Binding, at table: business_process, for columns: [org.hibernate.mapping.Column(binding)]
at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:454)
at org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:421)
at org.hibernate.mapping.Property.isValid(Property.java:226)
at org.hibernate.mapping.PersistentClass.validate(PersistentClass.java:595)
at org.hibernate.mapping.RootClass.validate(RootClass.java:265)
at org.hibernate.boot.internal.MetadataImpl.validate(MetadataImpl.java:329)
at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:464)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:711)
at org.grails.orm.hibernate.cfg.HibernateMappingContextConfiguration.buildSessionFactory(HibernateMappingContextConfiguration.java:241)
at org.grails.orm.hibernate.HibernateMappingContextSessionFactoryBean.doBuildSessionFactory(HibernateMappingContextSessionFactoryBean.java:474)
at org.grails.orm.hibernate.HibernateMappingContextSessionFactoryBean.buildSessionFactory(HibernateMappingContextSessionFactoryBean.java:468)
at org.grails.orm.hibernate.HibernateMappingContextSessionFactoryBean.afterPropertiesSet(HibernateMappingContextSessionFactoryBean.java:92)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1637)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1574)
... 41 common frames omitted
这是我的Domain类,它定义了表:
class ScBusinessProcess {
String name;
ScStep step;
String description;
boolean promoted;
static hasMany = [
likes: ScBusinessProcessLike,
questions: ScQuestion
]
static constraints = {
step nullable: true
}
static mapping = {
table 'BUSINESS_PROCESS'
}
答案 0 :(得分:0)
在运行应用程序之前,尝试命令“ grails clean”。它为我工作。
目的: clean命令从应用程序中删除所有编译的资源。与Java一样,由于Groovy是一种编译语言,因此有时对于清除类的旧实例并确保正确的编译很有用。在运行测试或创建WAR文件以确保完全编译之前,最好运行此脚本。
参考:http://docs.grails.org/3.1.1/ref/Command%20Line/clean.html