Is there a way to tell Hibernate that it should be using a factory to instantiate new persistent objects rather than Constructor.newInstance()?
I know about Interceptor.instantiate() but in this particular case I don't know the class of the persistent objects until runtime so what I really need is to specify the factory rather than the persistent class in my mappings.
Is this something I'm going to have to implement? I'd imagine that a new attribute "factory" would be added to the class element in the mappings and then have the factory class implement an interface along these lines:
Code:
interface Factory {
public Object create(String name, Serializable id);
}
Anyway any suggestions/comments would be very welcome.
Ollie