-->
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.  [ 1 post ] 
Author Message
 Post subject: Persisting inhiretance with annotations
PostPosted: Sat Nov 21, 2009 3:37 am 
Newbie

Joined: Thu Aug 07, 2008 3:50 pm
Posts: 4
Hi all
I was trying to use hibernate annotations for the first time. I have created three classes: BaseEntity, Org and Chaine.
Both Org and Chaine extends BaseEntity.

public class BaseEntity {
@Column(name= "name")
private String name;
@Id
private Integer id;
}

@Entity
@Table(name="chaine")
public class Chaine extends BaseEntity {

}

@Entity
@Table(name = "Org")
public class Org extends BaseEntity {
@Column(name="email")
private String email;
}

I have getters and setter in all classes. But when I want to persist one of the entities I got the error (Initial SessionFactory creation failed.org.hibernate.AnnotationException: No identifier specified for entity:......)

If I add the attribute id with annotation @Id in Org for example, it worked.
How can I make hibernate see the Id in BaseEntity and use it?

Thank you for your help.


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

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.