-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Factory for persistent object creation?
PostPosted: Wed Feb 25, 2004 1:39 am 
Newbie

Joined: Fri Dec 05, 2003 12:44 am
Posts: 16
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


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 25, 2004 8:27 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Check the forum, it has been discussed. But it's not native in Hibernate.

_________________
Emmanuel


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.