У меня есть этот класс домена grails, который подключается к oracle БД, которая содержит составной первичный ключ следующим образом.
всякий раз, когда я пытаюсь отобразить попадание в список / конечную точку пола, всегда выдается ошибка this. Можете ли вы помочь мне, я работал над этой проблемой в течение последних двух дней, но я не могу решить ее .?
@Resource(uri="/gender",formats = ['json','xml'])
class CGender implements Serializable {
String budYear
String genderCode
String genderNdesc
String genderEdesc
String disableFlag
String createdBy
Date createdDate
int hashCode() {
def builder = new HashCodeBuilder()
builder.append budYear
builder.append genderCode
builder.toHashCode()
}
boolean equals(other) {
if (other == null) return false
def builder = new EqualsBuilder()
builder.append budYear, other.budYear
builder.append genderCode, other.genderCode
builder.isEquals()
}
static hasMany = [CProjects: CProject]
static belongsTo = [grails.tsa.test.CYear]
static mapping = {
id composite: ["budYear", "genderCode"]
table "C_GENDER"
version false
}
static constraints = {
budYear maxSize: 7
genderCode maxSize: 2
genderNdesc maxSize: 1000
genderEdesc maxSize: 100
disableFlag maxSize: 1
createdBy maxSize: 30
}
}```
**The error which occured is below.**
```Caused by: java.lang.NullPointerException: null
at org.grails.web.converters.marshaller.json.DomainClassMarshaller.marshalObject(DomainClassMarshaller.java:141)
at org.grails.web.converters.marshaller.json.DomainClassMarshaller.marshalObject(DomainClassMarshaller.java:59)
at grails.converters.JSON.value(JSON.java:184)
at grails.converters.JSON.convertAnother(JSON.java:144)
at org.grails.web.converters.marshaller.json.CollectionMarshaller.marshalObject(CollectionMarshaller.java:41)
at org.grails.web.converters.marshaller.json.CollectionMarshaller.marshalObject(CollectionMarshaller.java:30)
at grails.converters.JSON.value(JSON.java:184)
at grails.converters.JSON.render(JSON.java:119)
at org.grails.plugins.web.rest.render.json.DefaultJsonRenderer.renderJson(DefaultJsonRenderer.groovy:116)
at org.grails.plugins.web.rest.render.json.DefaultJsonRenderer.renderJson(DefaultJsonRenderer.groovy:110)
at org.grails.plugins.web.rest.render.json.DefaultJsonRenderer.render(DefaultJsonRenderer.groovy:91)
at grails.artefact.controller.RestResponder$Trait$Helper.internalRespond(RestResponder.groovy:192)
at grails.artefact.controller.RestResponder$Trait$Helper.respond(RestResponder.groovy:62)
at grails.rest.RestfulController.index(RestfulController.groovy:62)
at grails.gorm.transactions.GrailsTransactionTemplate$2.doInTransaction(GrailsTransactionTemplate.groovy:94)
at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:140)
at grails.gorm.transactions.GrailsTransactionTemplate.execute(GrailsTransactionTemplate.groovy:91)
... 13 common frames omitted