views:

784

answers:

2

I'm working with a legacy database and corresponding Java Domain Classes. I'm trying to add Spring Security to the app and I'd like to use Java Domain Classes for that too, just to be consistent and keep everything together. Grails has no problem using both POGOs and POJOs, btw.

So, starting with a new, empty database and a new empty grails app, I added the Spring Security Plugin (acegi 0.5.1). Then I did:

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

That worked perfectly. My tables where created, etc. Then I created POJO domain classes and deleted the POGO classes. Everything then compiled fine, but when the app started up I got this error:

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 org.mortbay.jetty.webapp.WebAppContext@1dfe1a{/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)

My POJO's follow:

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);
     }

    }

}

UPDATE

It looks like the problem is related to the AuthorityPeople. I added a segregatey id key, made it the primary key and changed the object to:

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;
    }



}

and now I'm getting this error:

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
A: 

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

Sounds like a Hibernate problem, not Spring Security or your POJO or grails. You this in your Person class:

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

Is your annotation referring to something incorrect?

matt b
Thanks. I think that get's me going in the right direction. Please see the update to the question.
Brad Rhoads
A: 

I haven't gotten this to work and and until just now, haven't seen any evidence that anyone else has either. So I resorted to moving to grails objects. But I just found this solution. I haven't tried it yet. I'll post my results once I do.

BTW - I'd still like help with my implementation above, if anyone wants take another look at it.

Brad Rhoads