运行良好后,我的应用程序在启动时开始给我奇怪的域错误。无论我做什么,我都无法正常工作。
Caused by MappingException: Could not determine type for: appospherelaunchv1.Entity, at table: entity_history, for columns: [org.hibernate.mapping.Column(entity)]
EntityHistory类:
class EntityHistory {
Entity entity
Date startDate
Date endDate
Boolean isCurrent
Date changeDate
static belongsTo = [entity: Entity]
static constraints = {
entityTypeID nullable:false
startDate nullable:false
endDate nullable:true
changeDate nullable:false
isCurrent nullable:true
}
}
实体类别:
class Entity {
String description
Date changeDate
Date createDate
Date entityChangeDate
EntityTypes entityTypes
User user
Customer customer
Contacts contacts
LeadSources leadSources
EntityStatus entityStatus
static hasMany = [entityData: EntityData]
static belongsTo = [entityTypes: EntityTypes, user: User, customer: Customer, contacts: Contacts, leadSources: LeadSources, entityStatus: EntityStatus]
static constraints = {
user nullable:false
customer nullable:false
contacts nullable:false
leadSources nullable:false
description size:1..2000, nullable:true
entityTypes nullable:false
changeDate nullable:false
createDate nullable:false
entityStatus nullable: false
}
}
删除属于实体关系不会更改错误消息。有人看过这个错误吗?
最佳答案
我想如果您已经在的 EntityHistory 中定义了的属性,则无需定义与另一个属性相同的属性。
因此,请尝试从EntityHistory类中删除Entity实体,因为它无法与数据库中的列映射相同的name属性。
而且它可能已经搞砸了您的数据库。尝试在数据源中以“创建”模式在新的数据库实例中运行应用程序,以创建新的新表。
谢谢。
关于hibernate - Grails域映射异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33028700/