Hibernate version: 3.2.6.ga
Hi,
I'm using Annotations for mapping.
I was trying to mapping the following structure:
Code:
public class Order
{
// geters/seters
private IDestination destination;
}
public interface IDestination
{
Long getId();
void setId(Long id);
}
public class Destination1 implements IDestination
{
// implementation
private Long id;
}
public class Destination2 implements IDestination
{
// implementation
private Long id;
}
I tried to do the mapping like this:
Code:
@Entity
public class Order
{
// geters/seters
@ManyToOne
@JoinTable
private IDestination destination;
}
@MappedSuperclass
public interface IDestination
{
@Id
Long getId();
void setId(Long id);
}
@Entity
public class Destination1 implements IDestination
{
// implementation
private Long id;
}
@Entity
public class Destination2 implements IDestination
{
// implementation
private Long id;
}
When I tried to generate the database schema, it was not possible, and I got this errors messages:
1º.: The id was not defined to Destination1 and Destination2
2º.: IDestination is not a entity
is it possible to implement this kind of structure?
I want to the database schema to be like this.
Tables:
Order
Destination1
Destination2
Order_Destination1
Order_Destination2
Thanks.