0
運行正常後,我的應用程序開始在啓動時給我奇怪的域錯誤。無論我做什麼,我都無法得到這個工作。Grails域映射例外
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
}
}
卸下屬於實體關係不改變錯誤消息。有沒有人看過這個錯誤?
你能嘗試在新的數據庫實例中創建嗎? – Neoryder
根據我的經驗,如果你有一個'belongsTo'中定義的實體,你不必另外明確地定義它。如果你在'EntityHistory'域中保留了'Entity entity',你只需要聲明'belongsTo = Entity'。如果你刪除了'Entity entity',你可以保留'belongsTo = [entity:Entity]'。但是,由於您已經說刪除'belongsTo'完全不能解決問題,因此這可能沒有幫助。 – Rob
_running fine_和_strange域錯誤_之間發生了什麼? –