Hi,
I'm using
hibernate 3.2.6 (mapping with annotations) and I'm having an issue regarding mapping of an interface (or some trick to make it work) :\
This is my situation:
Code:
public interface IFoo {
public void doSomething();
}
@Entity
public class A implements IFoo {
public void doSomething() {}
}
@Entity
public class B extends SomethingForBNotForA implements IFoo {
public void doSomething() {}
}
@Entity
public class C extends B {
}
// I want to map the interface here
@Entity
public class Bar {
@ManyToOne
private IFoo foo;
}
Now there's a class that contains any objects of IFoo.
Is there any proper way to map this with hibernate ? I tried to use @MappedSuperClass, but that's not working on interfaces. I thought of making an abstract class of the interface, but that's going to give troubles since B already extends from another class which is not always IFoo.
*UPDATE*
I should be able to create a table in the db with Id and DTYPE as columns, I guess...
Thanks in advance, any suggestions are appreciated !