我已經表車輛,我已經寫了查詢,如下如何解決節點錯誤沒有數據類型在Hibernate中
Vehicle.executeQuery(「從車輛選擇audio_system」) 但我得到一個錯誤
ERROR groovy.grails.web.errors.GrailsExceptionResolver ###對於節點沒有任何數據類型:org.hibernate.hql.ast.tree.IdentNode - [IDENT] IdentNode: 'audio_system'{originalText = audio_system}
java.lang.IllegalStateException:沒有數據類型爲no DE:org.hibernate.hql.ast.tree.IdentNode - [IDENT] IdentNode: 'audio_system'{originalText = audio_system}車輛類的
源代碼如下
class Vehicle {
String vehicleSticker
String regNumber //plate
String chasisNumber
String engineNumber
Integer yearOfManufacture
Date purchasedOn
Boolean audioSystem
Boolean videoSystem
Boolean mobileCharger
Boolean laptopCharger
//Vehicle compliance
Date pucExpiry
Date pucTestingOn
Date taxTokenIssueDate
Date taxTokenExpiryDate
Date insuranceIssueDate
Date insuranceExpiryDate
Date permitIssueDate
Date permitExpiryDate
Date fitnessCertificateIssueDate
Date fitnessCertificateExpiryDate
Double odoReadingWhenServiceDone
Double dueOddReading
VendorRole vendor
VehicleType vehicleType
//RegistrationCertificate registrationCertificate
static mapping = {
//registrationCertificate(cascade:'all')
}
static constraints = {
yearOfManufacture(nullable:true)
regNumber(nullable:false,unique: true)
chasisNumber(blank:true)
engineNumber(blank:true)
purchasedOn(nullable:true)
taxTokenIssueDate(nullable:true)
taxTokenExpiryDate(nullable:true)
insuranceIssueDate(nullable:true)
insuranceExpiryDate(nullable:true)
permitIssueDate(nullable:true)
permitExpiryDate(nullable:true)
fitnessCertificateIssueDate(nullable:true)
fitnessCertificateExpiryDate(nullable:true)
odoReadingWhenServiceDone(nullable:true)
dueOddReading(nullable:true)
pucExpiry(nullable:true)
pucTestingOn(nullable:true)
vendor(nullable:true)
}
public String toString() {
"${vehicleSticker} ${regNumber?'| '+ regNumber:''}"
}
您能否提供客戶端和車輛的完整源代碼? – 2011-05-12 06:42:15
我編輯了這個問題。 – n92 2011-05-12 06:49:55
即使當我嘗試獲取除id以外的任何字段我都會收到錯誤 – n92 2011-05-12 06:53:17