-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: Problem with annotations and ID mapping in super class
PostPosted: Sun Apr 03, 2005 6:30 am 
Newbie

Joined: Wed Mar 30, 2005 3:39 pm
Posts: 4
Hi All,

I get an NPE, when I try to map the ID in a general super class and use the OneToOne mapping (with XDoclet this has been working fine).

Hibernate version:
3.0rc
annotations 3.0 alpha 3

Example:

Code:
@Entity
public class DomainObject extends AbstractDomainObject {

    private Address address;

    @OneToOne(cascade = { CascadeType.CREATE })
    @JoinColumn(name = "ADDRESS_ID")
    public Address getAddress() {
        return address;
    }

    public void setAddress( Address address ) {
        this.address = address;
    }
}

The general super class:
Code:
public abstract class AbstractDomainObject {

    private long id;

    @Id(generate = GeneratorType.AUTO)
    public long getId() {
        return id;
    }

    public void setId( long id ) {
        this.id = id;
    }
}


Stack trace:
Code:
java.lang.NullPointerException
   at org.hibernate.cfg.AnnotationBinder.bindOneToOne(AnnotationBinder.java:1139)
   at org.hibernate.cfg.AnnotationBinder.processElementAnnotations(AnnotationBinder.java:734)
   at org.hibernate.cfg.AnnotationBinder.processElementsOfAClass(AnnotationBinder.java:532)
   at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:382)
   at org.hibernate.cfg.AnnotationConfiguration.addAnnotatedClass(AnnotationConfiguration.java:44)

Database dialect:
org.hibernate.dialect.MySQLInnoDBDialect

Thanks for any help!
Swen


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 05, 2005 1:12 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Please post a runnable test case into JIRA.
This case crossed my mind some times ago, but I did not check it.

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 05, 2005 5:06 pm 
Newbie

Joined: Wed Mar 30, 2005 3:39 pm
Posts: 4
I have created the JIRA entry HBX-210 + test case:
http://opensource.atlassian.com/projects/hibernate/browse/HBX-210

- Swen


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 06, 2005 4:31 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
tks

_________________
Emmanuel


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.