Hibernate version:
Mapping documents:
Code between sessionFactory.openSession() and session.close():
Full stack trace of any exception that occurs:
Name and version of the database you are using:
The generated SQL (show_sql=true):
Debug level Hibernate log excerpt:
Hi all, I designing an app, and I have something like the code bellow, I can't find a way to map it. What I want to do I to map it all in 1 table, and I don't know if it's posible, as car 'has a' Value this should be mapped as a component, but component doesn't support inheritance, I could map it as Object, but, How to map the Interfaces, in order to make polimorphic queries to retrieve for sell/rent cars or both. I'm a bit desperated. Thanks all in advance.
public class Car
{
//with getters and setters
private Value value;
...
}
public abstract class Value
{
}
public interface Let
{
public double getRent();
public setRent(double rent);
}
public interface Sell
{
public double getPrice();
public setPrice(double price);
}
public class ValueSellImpl extends Value implements Sell
{ ... }
public class ValueLetImpl extends Value implements Let
{ ... }
public class ValueLetSellImpl extends Value implements Let, Sell
{ ... }
|