|
Emmanuel, I'm not quite sure I quite follow your argument: I'd use Range<Integer> on the setBounds, as in Example e = new Example(); Hibernate can create an instance of Range using newInstance, and it can fill up the min/max fields of it, it just needs a way to know what type those fields should have when it hydrates. If you could do something like this: @AttributeOverrides({
@AttributeOverride(name="min", column = @Column(name="min_size"), type=@Type(type="int") ),
@AttributeOverride(name="max", column = @Column(name="max_size"), type=@Type(type="int") )
}) @AttributeOverrides({
@AttributeOverride(name="min", column = @Column(name="min_date"),type=@Type(type="date") ),
@AttributeOverride(name="max", column = @Column(name="max_date"),type=@Type(type="date") )
}) then you'd be able to use the single Range<T> class in the same entity (you could problably also guess the correct type using the Parameterized types of the fields). Kind of like you could do when using mapping files (mapping the same class as a component twice, only using different types for the fields). As it stands now, you need to make a specialized implementation every time you plan to use a Range of a different type. You're right, I did some tests with hibernate core and we can make it play nice if we explicit the type somehow. This is almost certainly the same bug that causes <a href=http://opensource.atlassian.com/projects/hibernate/browse/ANN-526 Sorry, I thought embedded HTML worked in JIRA. Again: This is almost certainly the same bug that causes ANN-526 (http://opensource.atlassian.com/projects/hibernate/browse/ANN-526 I believe this one is simpler to fix |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Thing is, you have to have an IntegerRange at some point in your system, otherwise, what do you fill up setBounds() with?
And that's the same for Hibernate, it needs to have a class it can call newInstance() on when the object is hydrated.