2009-07-29 4 views
0

Je travaille avec une base de données héritée et les classes de domaine Java correspondantes. J'essaie d'ajouter Spring Security à l'application et j'aimerais utiliser des classes de domaine Java pour cela aussi, juste pour être cohérent et tout garder ensemble. Grails n'a aucun problème à utiliser à la fois les POGO et les POJO, btw. Donc, à partir d'une nouvelle base de données vide et d'une nouvelle application grails vide, j'ai ajouté le Spring Security Plugin (acegi 0.5.1). Puis j'ai fait:Utilisation d'objets de domaine Java avec le plug-in Spring Security

grails create-auth-domains org.maflt.ibidem.pojo.Person org.maflt.ibidem.pojo.Authority org.maflt.ibidem.pojo.Requestmap 

Cela a fonctionné parfaitement. Mes tables où créé, etc. Puis j'ai créé des classes de domaine POJO et supprimé les classes POGO. Tout ensuite compilé bien, mais quand l'application a commencé Ï eu cette erreur:

2009-07-29 13:35:18,937 [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.springframework.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 'sessionFactory': Invocation of init method failed; nested exception is org.hibernate.AnnotationException: mappedBy reference an unknown target entity property: org.maflt.ibidem.pojo.AuthorityPeople.person in org.maflt.ibidem.pojo.Person.authorityPeoples 
     at java.security.AccessController.doPrivileged(Native Method) 
     at grails.web.container.EmbeddableServer$start.call(Unknown Source) 
     at _GrailsRun_groovy$_run_closure5_closure11.doCall(_GrailsRun_groovy:145) 
     at _GrailsRun_groovy$_run_closure5_closure11.doCall(_GrailsRun_groovy) 
     at _GrailsSettings_groovy$_run_closure10.doCall(_GrailsSettings_groovy:274) 
     at _GrailsSettings_groovy$_run_closure10.call(_GrailsSettings_groovy) 
     at _GrailsRun_groovy$_run_closure5.doCall(_GrailsRun_groovy:137) 
     at _GrailsRun_groovy$_run_closure5.call(_GrailsRun_groovy) 
     at _GrailsRun_groovy.runInline(_GrailsRun_groovy:104) 
     at _GrailsRun_groovy.this$4$runInline(_GrailsRun_groovy) 
     at _GrailsRun_groovy$_run_closure1.doCall(_GrailsRun_groovy:58) 
     at RunApp$_run_closure1.doCall(RunApp:33) 
     at gant.Gant$_dispatch_closure4.doCall(Gant.groovy:324) 
     at gant.Gant$_dispatch_closure6.doCall(Gant.groovy:334) 
     at gant.Gant$_dispatch_closure6.doCall(Gant.groovy) 
     at gant.Gant.withBuildListeners(Gant.groovy:344) 
     at gant.Gant.this$2$withBuildListeners(Gant.groovy) 
     at gant.Gant$this$2$withBuildListeners.callCurrent(Unknown Source) 
     at gant.Gant.dispatch(Gant.groovy:334) 
     at gant.Gant.this$2$dispatch(Gant.groovy) 
     at gant.Gant.invokeMethod(Gant.groovy) 
     at gant.Gant.processTargets(Gant.groovy:495) 
     at gant.Gant.processTargets(Gant.groovy:480) 
Caused by: org.springframework.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 'sessionFactory': Invocation of init method failed; nested exception is org.hibernate.AnnotationException: mappedBy reference an unknown target entity property: org.maflt.ibidem.pojo.AuthorityPeople.person in org.maflt.ibidem.pojo.Person.authorityPeoples 
     at java.security.AccessController.doPrivileged(Native Method) 
     ... 23 more 
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Invocation of init method failed; nested exception is org.hibernate.AnnotationException: mappedBy reference an unknown target entity property: org.maflt.ibidem.pojo.AuthorityPeople.person in org.maflt.ibidem.pojo.Person.authorityPeoples 
     at java.security.AccessController.doPrivileged(Native Method) 
     ... 24 more 
Caused by: org.hibernate.AnnotationException: mappedBy reference an unknown target entity property: org.maflt.ibidem.pojo.AuthorityPeople.person in org.maflt.ibidem.pojo.Person.authorityPeoples 
     ... 25 more 
2009-07-29 13:35:18,968 [main] ERROR mortbay.log - Failed startup of context [email protected]{/sectest2,C:\src\netbeansprojects\sectest2/web-app} 
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'messageSource': Initialization of bean failed; nested exception is org.springframework.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 'sessionFactory': Invocation of init method failed; nested exception is org.hibernate.AnnotationException: mappedBy reference an unknown target entity property: org.maflt.ibidem.pojo.AuthorityPeople.person in org.maflt.ibidem.pojo.Person.authorityPeoples 
     at java.security.AccessController.doPrivileged(Native Method) 
     at grails.web.container.EmbeddableServer$start.call(Unknown Source) 
     at _GrailsRun_groovy$_run_closure5_closure11.doCall(_GrailsRun_groovy:145) 
     at _GrailsRun_groovy$_run_closure5_closure11.doCall(_GrailsRun_groovy) 
     at _GrailsSettings_groovy$_run_closure10.doCall(_GrailsSettings_groovy:274) 
     at _GrailsSettings_groovy$_run_closure10.call(_GrailsSettings_groovy) 
     at _GrailsRun_groovy$_run_closure5.doCall(_GrailsRun_groovy:137) 
     at _GrailsRun_groovy$_run_closure5.call(_GrailsRun_groovy) 
     at _GrailsRun_groovy.runInline(_GrailsRun_groovy:104) 
     at _GrailsRun_groovy.this$4$runInline(_GrailsRun_groovy) 
     at _GrailsRun_groovy$_run_closure1.doCall(_GrailsRun_groovy:58) 
     at RunApp$_run_closure1.doCall(RunApp:33) 
     at gant.Gant$_dispatch_closure4.doCall(Gant.groovy:324) 
     at gant.Gant$_dispatch_closure6.doCall(Gant.groovy:334) 
     at gant.Gant$_dispatch_closure6.doCall(Gant.groovy) 
     at gant.Gant.withBuildListeners(Gant.groovy:344) 
     at gant.Gant.this$2$withBuildListeners(Gant.groovy) 
     at gant.Gant$this$2$withBuildListeners.callCurrent(Unknown Source) 
     at gant.Gant.dispatch(Gant.groovy:334) 
     at gant.Gant.this$2$dispatch(Gant.groovy) 
     at gant.Gant.invokeMethod(Gant.groovy) 
     at gant.Gant.processTargets(Gant.groovy:495) 
     at gant.Gant.processTargets(Gant.groovy:480) 
Caused by: org.springframework.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 'sessionFactory': Invocation of init method failed; nested exception is org.hibernate.AnnotationException: mappedBy reference an unknown target entity property: org.maflt.ibidem.pojo.AuthorityPeople.person in org.maflt.ibidem.pojo.Person.authorityPeoples 
     at java.security.AccessController.doPrivileged(Native Method) 
     ... 23 more 
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Invocation of init method failed; nested exception is org.hibernate.AnnotationException: mappedBy reference an unknown target entity property: org.maflt.ibidem.pojo.AuthorityPeople.person in org.maflt.ibidem.pojo.Person.authorityPeoples 
     at java.security.AccessController.doPrivileged(Native Method) 
     ... 24 more 
Caused by: org.hibernate.AnnotationException: mappedBy reference an unknown target entity property: org.maflt.ibidem.pojo.AuthorityPeople.person in org.maflt.ibidem.pojo.Person.authorityPeoples 
     ... 25 more 
2009-07-29 13:35:19,031 [main] ERROR mortbay.log - Nested in org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'messageSource': Initialization of bean failed; nested exception is org.springframework.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 'sessionFactory': Invocation of init method failed; nested exception is org.hibernate.AnnotationException: mappedBy reference an unknown target entity property: org.maflt.ibidem.pojo.AuthorityPeople.person in org.maflt.ibidem.pojo.Person.authorityPeoples: 
org.hibernate.AnnotationException: mappedBy reference an unknown target entity property: org.maflt.ibidem.pojo.AuthorityPeople.person in org.maflt.ibidem.pojo.Person.authorityPeoples 
     at java.security.AccessController.doPrivileged(Native Method) 
     at java.security.AccessController.doPrivileged(Native Method) 
     at java.security.AccessController.doPrivileged(Native Method) 
     at grails.web.container.EmbeddableServer$start.call(Unknown Source) 
     at _GrailsRun_groovy$_run_closure5_closure11.doCall(_GrailsRun_groovy:145) 
     at _GrailsRun_groovy$_run_closure5_closure11.doCall(_GrailsRun_groovy) 
     at _GrailsSettings_groovy$_run_closure10.doCall(_GrailsSettings_groovy:274) 
     at _GrailsSettings_groovy$_run_closure10.call(_GrailsSettings_groovy) 
     at _GrailsRun_groovy$_run_closure5.doCall(_GrailsRun_groovy:137) 
     at _GrailsRun_groovy$_run_closure5.call(_GrailsRun_groovy) 
     at _GrailsRun_groovy.runInline(_GrailsRun_groovy:104) 
     at _GrailsRun_groovy.this$4$runInline(_GrailsRun_groovy) 
     at _GrailsRun_groovy$_run_closure1.doCall(_GrailsRun_groovy:58) 
     at RunApp$_run_closure1.doCall(RunApp:33) 
     at gant.Gant$_dispatch_closure4.doCall(Gant.groovy:324) 
     at gant.Gant$_dispatch_closure6.doCall(Gant.groovy:334) 
     at gant.Gant$_dispatch_closure6.doCall(Gant.groovy) 
     at gant.Gant.withBuildListeners(Gant.groovy:344) 
     at gant.Gant.this$2$withBuildListeners(Gant.groovy) 
     at gant.Gant$this$2$withBuildListeners.callCurrent(Unknown Source) 
     at gant.Gant.dispatch(Gant.groovy:334) 
     at gant.Gant.this$2$dispatch(Gant.groovy) 
     at gant.Gant.invokeMethod(Gant.groovy) 
     at gant.Gant.processTargets(Gant.groovy:495) 
     at gant.Gant.processTargets(Gant.groovy:480) 

le suivi de mon POJO:

org.maflt.ibidem.pojo.Person

package org.maflt.ibidem.pojo; 

import java.util.List; 
import java.io.Serializable; 
import java.sql.Timestamp; 

import javax.persistence.Basic; 
import javax.persistence.Entity; 
import javax.persistence.GeneratedValue; 
import javax.persistence.Id; 
import javax.persistence.Table; 
import javax.persistence.Column; 
import javax.persistence.FetchType; 
import javax.persistence.JoinColumn; 
import javax.persistence.JoinColumns; 
import javax.persistence.ManyToOne; 
import javax.persistence.OneToMany; 
import javax.persistence.Transient; 
import javax.persistence.Embeddable; 

/** 
* <p>Pojo mapping TABLE person</p> 
* <p></p> 
* 
* <p>Generated at Wed Jul 29 11:48:39 MDT 2009</p> 
* @author Salto-db Generator v1.0.16/EJB3 
* 
*/ 
@Entity 
@Table(name = "person", catalog = "test") 
@SuppressWarnings("serial") 
public class Person implements Serializable { 

    /** 
    * Attribute id. 
    */ 
    private Long id; 

    /** 
    * Attribute version. 
    */ 
    private Long version; 

    /** 
    * Attribute companyName. 
    */ 
    private String companyName; 

    /** 
    * Attribute description. 
    */ 
    private String description; 

    /** 
    * Attribute email. 
    */ 
    private String email; 

    /** 
    * Attribute emailShow. 
    */ 
    private Boolean emailShow; 

    /** 
    * Attribute enabled. 
    */ 
    private Boolean enabled; 

    /** 
    * Attribute passwd. 
    */ 
    private String passwd; 

    /** 
    * Attribute userRealName. 
    */ 
    private String userRealName; 

    /** 
    * Attribute username. 
    */ 
    private String username; 

    /** 
    * List of AuthorityPeople 
    */ 
    private List<AuthorityPeople> authorityPeoples = null; 


    /** 
    * <p> 
    * </p> 
    * @return id 
    */ 
    @Basic 
    @Id 
    @GeneratedValue 
    @Column(name = "id") 
     public Long getId() { 
     return id; 
    } 

    /** 
    * @param id new value for id 
    */ 
    public void setId(Long id) { 
     this.id = id; 
    } 

    /** 
    * <p> 
    * </p> 
    * @return version 
    */ 
    @Basic 
    @Column(name = "version") 
     public Long getVersion() { 
     return version; 
    } 

    /** 
    * @param version new value for version 
    */ 
    public void setVersion(Long version) { 
     this.version = version; 
    } 

    /** 
    * <p> 
    * </p> 
    * @return companyName 
    */ 
    @Basic 
    @Column(name = "company_name", length = 255) 
     public String getCompanyName() { 
     return companyName; 
    } 

    /** 
    * @param companyName new value for companyName 
    */ 
    public void setCompanyName(String companyName) { 
     this.companyName = companyName; 
    } 

    /** 
    * <p> 
    * </p> 
    * @return description 
    */ 
    @Basic 
    @Column(name = "description", length = 255) 
     public String getDescription() { 
     return description; 
    } 

    /** 
    * @param description new value for description 
    */ 
    public void setDescription(String description) { 
     this.description = description; 
    } 

    /** 
    * <p> 
    * </p> 
    * @return email 
    */ 
    @Basic 
    @Column(name = "email", length = 255) 
     public String getEmail() { 
     return email; 
    } 

    /** 
    * @param email new value for email 
    */ 
    public void setEmail(String email) { 
     this.email = email; 
    } 

    /** 
    * <p> 
    * </p> 
    * @return emailShow 
    */ 
    @Basic 
    @Column(name = "email_show") 
     public Boolean getEmailShow() { 
     return emailShow; 
    } 

    /** 
    * @param emailShow new value for emailShow 
    */ 
    public void setEmailShow(Boolean emailShow) { 
     this.emailShow = emailShow; 
    } 

    /** 
    * <p> 
    * </p> 
    * @return enabled 
    */ 
    @Basic 
    @Column(name = "enabled") 
     public Boolean getEnabled() { 
     return enabled; 
    } 

    /** 
    * @param enabled new value for enabled 
    */ 
    public void setEnabled(Boolean enabled) { 
     this.enabled = enabled; 
    } 

    /** 
    * <p> 
    * </p> 
    * @return passwd 
    */ 
    @Basic 
    @Column(name = "passwd", length = 255) 
     public String getPasswd() { 
     return passwd; 
    } 

    /** 
    * @param passwd new value for passwd 
    */ 
    public void setPasswd(String passwd) { 
     this.passwd = passwd; 
    } 

    /** 
    * <p> 
    * </p> 
    * @return userRealName 
    */ 
    @Basic 
    @Column(name = "user_real_name", length = 255) 
     public String getUserRealName() { 
     return userRealName; 
    } 

    /** 
    * @param userRealName new value for userRealName 
    */ 
    public void setUserRealName(String userRealName) { 
     this.userRealName = userRealName; 
    } 

    /** 
    * <p> 
    * </p> 
    * @return username 
    */ 
    @Basic 
    @Column(name = "username", length = 255) 
     public String getUsername() { 
     return username; 
    } 

    /** 
    * @param username new value for username 
    */ 
    public void setUsername(String username) { 
     this.username = username; 
    } 

    /** 
    * Get the list of AuthorityPeople 
    */ 
    @OneToMany(mappedBy="person") 
    public List<AuthorityPeople> getAuthorityPeoples() { 
     return this.authorityPeoples; 
    } 

    /** 
    * Set the list of AuthorityPeople 
    */ 
    public void setAuthorityPeoples(List<AuthorityPeople> authorityPeoples) { 
     this.authorityPeoples = authorityPeoples; 
    } 


} 

org.maflt .ibidem.pojo.Authority

package org.maflt.ibidem.pojo; 

import java.util.List; 
import java.io.Serializable; 
import java.sql.Timestamp; 

import javax.persistence.Basic; 
import javax.persistence.Entity; 
import javax.persistence.GeneratedValue; 
import javax.persistence.Id; 
import javax.persistence.Table; 
import javax.persistence.Column; 
import javax.persistence.FetchType; 
import javax.persistence.JoinColumn; 
import javax.persistence.JoinColumns; 
import javax.persistence.ManyToOne; 
import javax.persistence.OneToMany; 
import javax.persistence.Transient; 
import javax.persistence.Embeddable; 

/** 
* <p>Pojo mapping TABLE authority</p> 
* <p></p> 
* 
* <p>Generated at Wed Jul 29 11:48:38 MDT 2009</p> 
* @author Salto-db Generator v1.0.16/EJB3 
* 
*/ 
@Entity 
@Table(name = "authority", catalog = "test") 
@SuppressWarnings("serial") 
public class Authority implements Serializable { 

    /** 
    * Attribute id. 
    */ 
    private Long id; 

    /** 
    * Attribute version. 
    */ 
    private Long version; 

    /** 
    * Attribute authority. 
    */ 
    private String authority; 

    /** 
    * Attribute description. 
    */ 
    private String description; 

    /** 
    * List of AuthorityPeople 
    */ 
    private List<AuthorityPeople> authorityPeoples = null; 


    /** 
    * <p> 
    * </p> 
    * @return id 
    */ 
    @Basic 
    @Id 
    @GeneratedValue 
    @Column(name = "id") 
     public Long getId() { 
     return id; 
    } 

    /** 
    * @param id new value for id 
    */ 
    public void setId(Long id) { 
     this.id = id; 
    } 

    /** 
    * <p> 
    * </p> 
    * @return version 
    */ 
    @Basic 
    @Column(name = "version") 
     public Long getVersion() { 
     return version; 
    } 

    /** 
    * @param version new value for version 
    */ 
    public void setVersion(Long version) { 
     this.version = version; 
    } 

    /** 
    * <p> 
    * </p> 
    * @return authority 
    */ 
    @Basic 
    @Column(name = "authority", length = 255) 
     public String getAuthority() { 
     return authority; 
    } 

    /** 
    * @param authority new value for authority 
    */ 
    public void setAuthority(String authority) { 
     this.authority = authority; 
    } 

    /** 
    * <p> 
    * </p> 
    * @return description 
    */ 
    @Basic 
    @Column(name = "description", length = 255) 
     public String getDescription() { 
     return description; 
    } 

    /** 
    * @param description new value for description 
    */ 
    public void setDescription(String description) { 
     this.description = description; 
    } 

    /** 
    * Get the list of AuthorityPeople 
    */ 
    @OneToMany(mappedBy="authority") 
    public List<AuthorityPeople> getAuthorityPeoples() { 
     return this.authorityPeoples; 
    } 

    /** 
    * Set the list of AuthorityPeople 
    */ 
    public void setAuthorityPeoples(List<AuthorityPeople> authorityPeoples) { 
     this.authorityPeoples = authorityPeoples; 
    } 


} 

org.maflt.ibidem.pojo.Requestmap

package org.maflt.ibidem.pojo; 

import java.util.List; 
import java.io.Serializable; 
import java.sql.Timestamp; 

import javax.persistence.Basic; 
import javax.persistence.Entity; 
import javax.persistence.GeneratedValue; 
import javax.persistence.Id; 
import javax.persistence.Table; 
import javax.persistence.Column; 
import javax.persistence.FetchType; 
import javax.persistence.JoinColumn; 
import javax.persistence.JoinColumns; 
import javax.persistence.ManyToOne; 
import javax.persistence.OneToMany; 
import javax.persistence.Transient; 
import javax.persistence.Embeddable; 

/** 
* <p>Pojo mapping TABLE requestmap</p> 
* <p></p> 
* 
* <p>Generated at Wed Jul 29 11:48:39 MDT 2009</p> 
* @author Salto-db Generator v1.0.16/EJB3 
* 
*/ 
@Entity 
@Table(name = "requestmap", catalog = "test") 
@SuppressWarnings("serial") 
public class Requestmap implements Serializable { 

    /** 
    * Attribute id. 
    */ 
    private Long id; 

    /** 
    * Attribute version. 
    */ 
    private Long version; 

    /** 
    * Attribute configAttribute. 
    */ 
    private String configAttribute; 

    /** 
    * Attribute url. 
    */ 
    private String url; 


    /** 
    * <p> 
    * </p> 
    * @return id 
    */ 
    @Basic 
    @Id 
    @GeneratedValue 
    @Column(name = "id") 
     public Long getId() { 
     return id; 
    } 

    /** 
    * @param id new value for id 
    */ 
    public void setId(Long id) { 
     this.id = id; 
    } 

    /** 
    * <p> 
    * </p> 
    * @return version 
    */ 
    @Basic 
    @Column(name = "version") 
     public Long getVersion() { 
     return version; 
    } 

    /** 
    * @param version new value for version 
    */ 
    public void setVersion(Long version) { 
     this.version = version; 
    } 

    /** 
    * <p> 
    * </p> 
    * @return configAttribute 
    */ 
    @Basic 
    @Column(name = "config_attribute", length = 255) 
     public String getConfigAttribute() { 
     return configAttribute; 
    } 

    /** 
    * @param configAttribute new value for configAttribute 
    */ 
    public void setConfigAttribute(String configAttribute) { 
     this.configAttribute = configAttribute; 
    } 

    /** 
    * <p> 
    * </p> 
    * @return url 
    */ 
    @Basic 
    @Column(name = "url", length = 255) 
     public String getUrl() { 
     return url; 
    } 

    /** 
    * @param url new value for url 
    */ 
    public void setUrl(String url) { 
     this.url = url; 
    } 



} 

org.maflt.ibidem.pojo.AthorityPeople

package org.maflt.ibidem.pojo; 

import java.util.List; 
import java.io.Serializable; 
import java.sql.Timestamp; 

import javax.persistence.Basic; 
import javax.persistence.Entity; 
import javax.persistence.GeneratedValue; 
import javax.persistence.Id; 
import javax.persistence.Table; 
import javax.persistence.Column; 
import javax.persistence.FetchType; 
import javax.persistence.JoinColumn; 
import javax.persistence.JoinColumns; 
import javax.persistence.ManyToOne; 
import javax.persistence.OneToMany; 
import javax.persistence.Transient; 
import javax.persistence.Embeddable; 

/** 
* <p>Pojo mapping TABLE authority_people</p> 
* <p></p> 
* 
* <p>Generated at Wed Jul 29 11:48:39 MDT 2009</p> 
* @author Salto-db Generator v1.0.16/EJB3 
* 
*/ 
@Entity 
@Table(name = "authority_people", catalog = "test") 
@SuppressWarnings("serial") 
public class AuthorityPeople implements Serializable { 

    /** 
    * Primary key 
    */ 
    private AuthorityPeoplePK authorityPeoplePK; 


    /** 
    * Get the primary key 
    */ 
    @Basic 
    @Id 
    public AuthorityPeoplePK getAuthorityPeoplePK() { 
     return this.authorityPeoplePK; 
    } 

    /** 
    * set the primary key 
    */ 
    public void setAuthorityPeoplePK(AuthorityPeoplePK authorityPeoplePK) { 
     this.authorityPeoplePK = authorityPeoplePK; 
    } 






    /** 
      * <p>Composite primary key for table authority_people</p> 
     * 
     * <p>Generated at Wed Jul 29 11:48:39 MDT 2009</p> 
     * @author Salto-db Generator v1.0.16/EJB3 
     */ 
    @SuppressWarnings("serial") 
    @Embeddable 
    public static class AuthorityPeoplePK implements Serializable { 

     /** 
     * Attribute authority 
     */ 
     private Authority authority; 


     /** 
     * Attribute person 
     */ 
     private Person person; 


    /** 
    * get authority 
    */ 
      @ManyToOne 
      @JoinColumn(name = "authority_id") 
      public Authority getAuthority() { 
       return this.authority; 
      } 

      /** 
      * set authority 
      */ 
      public void setAuthority(Authority authority) { 
       this.authority = authority; 
      }  
    /** 
    * get person 
    */ 
      @ManyToOne 
      @JoinColumn(name = "person_id") 
      public Person getPerson() { 
       return this.person; 
      } 

      /** 
      * set person 
      */ 
      public void setPerson(Person person) { 
       this.person = person; 
      }  

     /** 
     * calculate hashcode 
     */ 
     @Override 
     public int hashCode() 
     { 
      //TODO : implement this method 
      return super.hashCode(); 
     } 

     /** 
     * equals method 
     */ 
     @Override 
     public boolean equals(Object object) 
     { 
      //TODO : implement this method 
      return super.equals(object); 
     } 

    } 

} 

MISE À JOUR

Il semble que le problème est lié à la AuthorityPeople. J'ai ajouté une clé id segregatey, fait la clé primaire et changé l'objet:

package org.maflt.ibidem.pojo; 

import java.util.List; 
import java.io.Serializable; 
import java.sql.Timestamp; 

import javax.persistence.Basic; 
import javax.persistence.Entity; 
import javax.persistence.GeneratedValue; 
import javax.persistence.Id; 
import javax.persistence.Table; 
import javax.persistence.Column; 
import javax.persistence.FetchType; 
import javax.persistence.JoinColumn; 
import javax.persistence.JoinColumns; 
import javax.persistence.ManyToOne; 
import javax.persistence.OneToMany; 
import javax.persistence.Transient; 
import javax.persistence.Embeddable; 

/** 
* <p>Pojo mapping TABLE authority_people</p> 
* <p></p> 
* 
* <p>Generated at Wed Jul 29 19:34:03 MDT 2009</p> 
* @author Salto-db Generator v1.0.16/EJB3 
* 
*/ 
@Entity 
@Table(name = "authority_people", catalog = "test") 
@SuppressWarnings("serial") 
public class AuthorityPeople implements Serializable { 

    /** 
    * Attribute authority 
    */ 
    private Authority authority; 

    /** 
    * Attribute person 
    */ 
    private Person person; 

    /** 
    * Attribute id. 
    */ 
    private Long id; 


    /** 
    * get authority 
    */ 
    @ManyToOne 
    @JoinColumn(name = "authority_id") 
    public Authority getAuthority() { 
     return this.authority; 
    } 

    /** 
    * set authority 
    */ 
    public void setAuthority(Authority authority) { 
     this.authority = authority; 
    } 

    /** 
    * get person 
    */ 
    @ManyToOne 
    @JoinColumn(name = "person_id") 
    public Person getPerson() { 
     return this.person; 
    } 

    /** 
    * set person 
    */ 
    public void setPerson(Person person) { 
     this.person = person; 
    } 

    /** 
    * <p> 
    * </p> 
    * @return id 
    */ 
    @Basic 
    @Id 
    @Column(name = "id") 
     public Long getId() { 
     return id; 
    } 

    /** 
    * @param id new value for id 
    */ 
    public void setId(Long id) { 
     this.id = id; 
    } 



} 

et maintenant je reçois cette erreur:

java.lang.NullPointerException: Cannot invoke method list() on null object 
     at org.codehaus.groovy.runtime.NullObject.invokeMethod(NullObject.java:77) 
     at org.codehaus.groovy.runtime.InvokerHelper.invokePogoMethod(InvokerHelper.java:750) 
     at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:727) 
     at org.codehaus.groovy.runtime.callsite.NullCallSite.call(NullCallSite.java:17) 
     at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:40) 
     at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite 
+0

Plus de trace de pile: java.lang.NullPointerException: Impossible d'appeler la méthode list() sur l'objet nul . . . org.codehaus.groovy.runtime.callsite.AbstractCallSite.call (AbstractCallSite.java:121) à org.codehaus.groovy.grails.plugins.springsecurity.RequestmapFilterInvocationDefinitionHelper.loadRequestmaps (RequestmapFilterInvocationDefinitionHelper.groovy: 51) à org.codehaus .groovy.grails.plugins.springsecurity.RequestmapFilterInvocationDefinition.reset (RequestmapFilterInvocationDefinition.java:57) à org.codehaus.groovy.grails.plugins.springsecurity.RequestmapFilterI –

Répondre

0

Caused by: org.hibernate.AnnotationException: mappedBy reference an unknown target entity property: org.maflt.ibidem.pojo.AuthorityPeople.person in org.maflt.ibidem.pojo.Person.authorityPeoples

Sons comme un problème Hibernate, pas Spring Security ou votre POJO ou des grails. Vous ceci dans votre classe Personne:

@OneToMany(mappedBy="person") 
public List<AuthorityPeople> getAuthorityPeoples() { 
    return this.authorityPeoples; 
} 

Votre annotation fait-elle référence à quelque chose d'incorrect?

+0

Merci. Je pense que ça me va dans la bonne direction. S'il vous plaît voir la mise à jour à la question. –

0

Je n'ai pas eu ce travail et, jusqu'à maintenant, je n'ai vu aucune preuve que quelqu'un d'autre a. J'ai donc décidé de passer à des objets de gravier. Mais je viens de trouver this solution. Je ne l'ai pas encore essayé. Je posterai mes résultats une fois que je le ferai.

BTW - J'aimerais toujours avoir de l'aide avec mon implémentation ci-dessus, si quelqu'un veut y jeter un coup d'oeil.

Questions connexes