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.  [ 3 posts ] 
Author Message
 Post subject: Factory replacement
PostPosted: Sun Aug 21, 2005 11:45 am 
Newbie

Joined: Sun Aug 21, 2005 11:36 am
Posts: 6
Hi,

Right now , Hibernate instantiates a class based on its real name and does a simple newInstance on the class it obtained.

I was wondering whether some slightly more sophisticated factory mechanism had been contemplated.

I would like to not put the name of the real class but rather put a logical name for it from which a factory could be obtained and an instnace created using a newInstance call on it.

I could not find it anywhere, can it be done today?

thank's
Jean Safar


Top
 Profile  
 
 Post subject: Re: Factory replacement
PostPosted: Mon Aug 22, 2005 1:56 am 
Regular
Regular

Joined: Sun May 08, 2005 2:48 am
Posts: 118
Location: United Kingdom
safarje wrote:
Hi,

Right now , Hibernate instantiates a class based on its real name and does a simple newInstance on the class it obtained.

I was wondering whether some slightly more sophisticated factory mechanism had been contemplated.

I would like to not put the name of the real class but rather put a logical name for it from which a factory could be obtained and an instnace created using a newInstance call on it.

I could not find it anywhere, can it be done today?

thank's
Jean Safar


To confirm I understand you.

You wish Hibernate to instate concrete classes through a factory class ?


My understanding of Hibernate is that it is an Object Relational Mapping system that is based on clear reversable rules between concrete classes and JDBC data access (through mapping information). Since its purpose is to be able to persist concrete classes.

Hibernate only instates classes that were fetched from persistant storage. For them to be in persistant storage in the first place they must have been a concrete representation of some object in the past.

So I don't understand your design pattern that introduces a factory class in the middle. You can only ask Hibernate to fetch a concrete class, if you need a factory to work out exactly which concrete class you want, this sounds more like work that should be done in your DAO layer, that sits above Hibernate.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 22, 2005 2:45 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
Interceptor.instantiate() and look at entityname.

_________________
Max
Don't forget to rate


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.