Hello.
I'm gonna write an internet shop, and currently i'm thinking about its Model layer.
If it's gonna be an abstract Entity, then users should be able to add arbitrary types of Entities to the shop.
For example, they might want to add a Vehicle, or a Flower, or a Pig.
Each such entity has different properties, for example a Vehicle has its speed, a Flower has its sort, and a Pig has its farm, where it has been breeded.
So, how can I implement all these infinite properties in Hibernate, so that it be fast and lightweight?
I could, for example, create a column named "additional properties" with some sort of XML such as:
Code:
<properties>
<property name="speed" value="10kmph"/>
<property name="age" value="10"/>
<property name="flavour" value="strawberry"/>
</properties>
But how would I then be able to get all the Juices with "strawberry" flavour?
There would be no query such as "from Entity entity where additionalProperties.flavour = "strawberry", would it?
What solution can you propose me to address this cusiom entity issue?
*As you've already understood, I'm unable to create the Juice class and map it in Hibernate - that's the user who creates new types of Entities.