Is there a good example of using @EmbeddableSuperclass tag with an abstract parent class?
I have abstract class AItem and subclass ItemHSQL that extends it. My problem is that the attributes in the parent class are not getting mapped to the table fields my subclass.
Here is the code:
Code:
@EmbeddableSuperclass(access=AccessType.FIELD)
@Table(name="Item")
public abstract class AItem implements IItem{
@Id
int id;
@Column(name="name")
String name;
public abstract int getId();
public abstract void setId(int id);
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
@Entity
@Table(name = "ITEM")
@Inheritance(strategy=InheritanceType.SINGLE_TABLE)
public class ItemHSQL extends AItem implements Serializable
{
final String CLASS_NAME="ItemHSQL";
public ItemHSQL(){};
public ItemHSQL(String name, double value)
{
this.name=name;
this.value = value;
}
@Id(generate = GeneratorType.AUTO)
public int getId ()
{
return id;
}
}
Any suggestions?