Hibernate - 无法确定列的类型:org.hibernate.mapping.Column(绑定)

Hibernate - Could not determine type for columns: org.hibernate.mapping.Column(binding)

在我从 Git 中提取代码并在 Hibernate 映射上失败后,我的基于 Hibernate 的 Grails 应用程序每次都无法构建。问题是,它可以在我朋友的系统上运行,但我不知道为什么它会在我的系统上崩溃。有很多关于此异常的类似帖子,它们主要与列中的问题有关。这里不同的是,我的table里面没有"binding"这样的栏目。这是异常代码:

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

这是我的域 class,它定义了 table:

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'
    }

在 运行 应用程序之前尝试命令 'grails clean'。它对我有用。

目的: clean 命令从应用程序中删除所有已编译的资源。由于 Groovy 是一种编译语言,与 Java 一样,这有时有助于清除 类 的旧实例并确保正确编译。在 运行 测试或创建 WAR 文件之前 运行 此脚本也是一个好主意,以确保进行完整编译。

参考:http://docs.grails.org/3.1.1/ref/Command%20Line/clean.html