Tôi nhận được lỗi "ORA-00972: số nhận dạng quá dài" trong khi lưu đối tượng lớp miền.ORA-00972: số nhận dạng quá dài - Chiến lược tốt nhất để tránh nó trong Grails
Caused by: org.hibernate.exception.SQLGrammarException: could not initialize a collection: [com.intelligrape.model.Address.studentsForPermanentAddressId#79366215]
Điều gì có thể là giải pháp khả thi để giải quyết vấn đề này ngoại trừ việc giảm độ dài của trường StudentsForPermanentAddressId. Lý do là, đây là một bảng cơ sở dữ liệu kế thừa mà tôi không thể thay đổi.
EDIT: Thêm mô tả lớp miền như yêu cầu của Rob Hruska
package com.intelligrape.model
class Address {
String address1
String address2
String boxNumber
String city
Long stateLid
String province
String zipCode
Long countryLid
Double latitude
Double longitude
Long radius
static hasMany = [studentsForPermanentAddressId: Student, studentsForLocalAddressId: Student]
static constraints = {
address1 nullable: true
address2 nullable: true
boxNumber nullable: true, size: 1..25
city nullable: true, size: 1..30
stateLid nullable: true
province nullable: true, size: 1..64
zipCode nullable: true, size: 1..15
countryLid nullable: true
latitude nullable: true
longitude nullable: true
radius nullable: true
studentsForPermanentAddressId nullable: true
studentsForLocalAddressId nullable: true
}
}
Thú vị, giới hạn độ dài của Oracle là 30 và 'studentsForPermanentAddressId'" chỉ "có 29 ký tự. – NullUserException
@NullUserException - Tôi không nghĩ 'studentsForPermanentAddressId' là tên của cột cơ sở dữ liệu thực tế; nó có thể ánh xạ tới một cái gì đó như 'students_for_permanent _...'. –
@Mohd - Bạn có thể cung cấp mã lớp miền xác định mối quan hệ được đề cập không? –