[jboss-jira] [JBoss JIRA] Created: (EJBTHREE-725) Problem with OneToOne annotation

Ilya (JIRA) jira-events at jboss.com
Wed Oct 4 12:26:41 EDT 2006


Problem with OneToOne annotation
--------------------------------

                 Key: EJBTHREE-725
                 URL: http://jira.jboss.com/jira/browse/EJBTHREE-725
             Project: EJB 3.0
          Issue Type: Bug
    Affects Versions: EJB 3.0 RC9 - FD
            Reporter: Ilya
            Priority: Minor


Given to classes as in hibernate doc: 

@Entity
public class Body {
    @Id
    public Long getId() { return id; }

    @OneToOne
    @PrimaryKeyJoinColumn
    public Heart getHeart() {
        return heart;
    }
    ...
}
            
@Entity
public class Heart {
    @Id
    public Long getId() { ...}

    @OneToOne(mappedBy = "heart")
    public Heart getHeart() {
        return heart;
    }
}

everything works, but when I moved mappedBy to body deployment failed with NPE in class OneToOneSecondPass on line 135, because otherSideProperty was null.

Testcase (deploymnt fails with NPE):
------------------
@Entity
public class Body {
    @Id
    public Long getId() { return id; }

    @OneToOne(mappedBy = "body")
    public Heart getHeart() {
        return heart;
    }
    ...
}
            
@Entity
public class Heart {
    @Id
    public Long getId() { ...}

    @OneToOne
    @PrimaryKeyJoinColumn
    public Heart getHeart() {
        return heart;
    }
}
------------------



-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jboss-jira mailing list