I have a class with some properties, where one of them is a strategy. The strategy doesn't have any fields, so I don't want to have a table for strategies. I'd love to map the strategy in the same table that maps every other property of my class (theoretically, Hibernate only needs the class type to be able to retrieve my object). How can I do something like that?
I ilustrate the case (if you show me how to map this with annotations I'll really apreciate it, but I will settle with any mapping you know):
Code:
public class SomeClass {
private String name;
private MyStrategy strategy;
...
}
public Interface MyStrategy {
public void doYourThing();
}
public class OneStrategy implements MyStrategy {
public void doYourThing() {
...
}
}
public class AnotherStrategy implements MyStrategy {
public void doYourThing() {
...
}
}