-->
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: How to map class with method's superclass.
PostPosted: Mon Jan 18, 2010 12:58 pm 
Newbie

Joined: Mon Jan 18, 2010 12:32 pm
Posts: 2
Hi Hibernate folks,

I want to know how to map method's superclass. Ok let's say i map a DomesticCat that have a superclass called Cat. I give you the code below. How i do with my hibernate mapping xml file to tell to the code that the getId/setId have to be retrieved in the superclass. Actually, i have an error message telling me that the getId/setId is not defined in the Cat class. It is normal because both methods are in the superclass. How to tell to the mapper to look in the superclass. I dont want to use JPA tough, just with hibernate 3.

Thanks in advance.

Code:
public class Cat {

private Long id; // identifier

public void setId(Long id) { this.id=id;}
public Long getId() { return id; }
}

public class DomesticCat extends Cat implements Serializable {

private String name = null;
private int age = 0

public String getName( return this.name; }
public void setName(String name) {this.name=name; }
public int getAge( return this.age; }
public void setAge(int age) {this.age=age; }
}


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.