Spring/Hibernate config design question

V

visionset

I have a series of Rule classes that are mainly behaviour. I generally need
just one object of each class.
They all inherit from a single superclass and are at present persisted as
@Entity through Hibernate.
I would like these rules to be configurable through Spring such that I may
have where neccessary more than 1 object per class. But the config state is
so disparate it won't fit neatly into the Hibernate inheritence persistence
scheme.

I'm thinking of just storing Spring Bean Ids for the Rule classes (as
properties in place of the original foreign key) via Hibernate then using
Spring to instantiate the Beans from this name and pull out config
properties from bean xml. If the bean definition does not exist then some
sensible default can be created and a Class.newInstance() performed.
I suppose I'd mark the Rule attribute as @Transient and lazily instantiate
it on request.

Does this sound like a decent plan?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top