org.hibernate.MappingException для доменных классов в Grails - PullRequest
2 голосов
/ 21 сентября 2010

У меня есть проект Grails, и все работает нормально.Я начал добавлять аннотации JAXB XML в классы моего домена, и внезапно я начал получать этот дамп стека.Что мне нужно сделать, чтобы это исправить, и почему оно появляется после того, как я начал добавлять аннотации XML?

2010-09-21 09:46:43,006 [main] ERROR context.ContextLoader  - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'messageSource': Initialization of bean failed; nested exception is org.s
pringframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager': Cannot resolve reference to bean 'sessionFactory' while
setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFacto
ry': Invocation of init method failed; nested exception is org.hibernate.MappingException: Could not determine type for: skillsdb.Client, at table: project, for
 columns: [org.hibernate.mapping.Column(client)]
    at org.grails.tomcat.TomcatServer.start(TomcatServer.groovy:164)
    at grails.web.container.EmbeddableServer$start.call(Unknown Source)
    at _GrailsRun_groovy$_run_closure5_closure12.doCall(_GrailsRun_groovy:158)
    at _GrailsRun_groovy$_run_closure5_closure12.doCall(_GrailsRun_groovy)
    at _GrailsSettings_groovy$_run_closure10.doCall(_GrailsSettings_groovy:280)
    at _GrailsSettings_groovy$_run_closure10.call(_GrailsSettings_groovy)
    at _GrailsRun_groovy$_run_closure5.doCall(_GrailsRun_groovy:149)
    at _GrailsRun_groovy$_run_closure5.call(_GrailsRun_groovy)
    at _GrailsRun_groovy.runInline(_GrailsRun_groovy:116)
    at _GrailsRun_groovy.this$4$runInline(_GrailsRun_groovy)
    at _GrailsRun_groovy$_run_closure1.doCall(_GrailsRun_groovy:59)
    at RunApp$_run_closure1.doCall(RunApp.groovy:33)
    at gant.Gant$_dispatch_closure5.doCall(Gant.groovy:381)
    at gant.Gant$_dispatch_closure7.doCall(Gant.groovy:415)
    at gant.Gant$_dispatch_closure7.doCall(Gant.groovy)
    at gant.Gant.withBuildListeners(Gant.groovy:427)
    at gant.Gant.this$2$withBuildListeners(Gant.groovy)
    at gant.Gant$this$2$withBuildListeners.callCurrent(Unknown Source)
    at gant.Gant.dispatch(Gant.groovy:415)
    at gant.Gant.this$2$dispatch(Gant.groovy)
    at gant.Gant.invokeMethod(Gant.groovy)
    at gant.Gant.executeTargets(Gant.groovy:590)
    at gant.Gant.executeTargets(Gant.groovy:589)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager': Cannot resolve reference to bean 'sessio
nFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with na
me 'sessionFactory': Invocation of init method failed; nested exception is org.hibernate.MappingException: Could not determine type for: skillsdb.Client, at tab
le: project, for columns: [org.hibernate.mapping.Column(client)]
    ... 23 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Invocation of init method failed; nested exc
eption is org.hibernate.MappingException: Could not determine type for: skillsdb.Client, at table: project, for columns: [org.hibernate.mapping.Column(client)]
    ... 23 more
Caused by: org.hibernate.MappingException: Could not determine type for: skillsdb.Client, at table: project, for columns: [org.hibernate.mapping.Column(client)]

    ... 23 more

Project.groovy:

package skillsdb;
import rc.RoleComparator;
import org.apache.commons.collections.list.LazyList;
import org.apache.commons.collections.FactoryUtils;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlSeeAlso;

@XmlAccessorType(XmlAccessType.NONE)
@XmlSeeAlso(Client.class)
public class Project implements Comparable
{  
static belongsTo = [employee:Employee]

static hasMany = [roles:Role]

static mapping = {
      description type:"text"
      roles lazy:false, cascade:"all,delete-orphan"
}
@XmlElement
Client client
}

Client.groovy

package skillsdb;
import javax.xml.bind.annotation.XmlAttribute;
class Client implements Comparable
{
 static constraints = 
  {
      name(blank:false)
  }
  @XmlAttribute
  String name
}
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...