mjstein6300 wrote:
Not sure if this is possible with hibernate, but....
I have one object, that depending on its state, can map to two different tables. Is there a way to have two mapping files for one object, and conditionally pick which one to use based on a flag in the object?
Thanks.
I think you need to be a little more clear on what you're trying to do.
But if I understand you correctly..... To map one Class to 2 different tables, see the <class> attribute "entity-name" in the documentation.
Then, since you have 2 separate mappings, you would need to query the objects by the specified entity-name. I believe you would also need to specify this entity-name when you persisted the objects.
You can also map 2 Objects to 1 table using a discriminator and based on the value of this, two different objects would be created. But I don't think that's what you're asking for.