-->
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.  [ 7 posts ] 
Author Message
 Post subject: Simple explanation of datasource vs SessionFactory
PostPosted: Tue Nov 29, 2005 8:41 am 
Newbie

Joined: Fri Jul 15, 2005 9:30 am
Posts: 13
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

I am having a hard time describing the differences between a DataSource and a SessionFactory (like what is provided by Hibernate) to a client. How they are different, what the pros and cons are for each.

If any of you can give me an example (not code but verbal example) or analogies that would be awesome.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 29, 2005 8:57 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Well, they have nothing to do with each other, really. It's like asking what a Car and an Apple have in common.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 29, 2005 9:13 am 
Newbie

Joined: Fri Jul 15, 2005 9:30 am
Posts: 13
I know that but for some reason, after reading your book, my client insists that the SessionFactory is a Datasource. I am trying to find verbal explanations between the two.

thanks


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 29, 2005 9:41 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
A SessionFactory is an instance that represents a Hibernate configuration for a particular datastore incl. all mapping metadata, at runtime. A Datasource is a data source. A SessionFactory can use a DataSource.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 29, 2005 3:40 pm 
Newbie

Joined: Fri Jul 15, 2005 9:30 am
Posts: 13
Thought of this a bit more but not sure if it is a good analogy

The datasource is like the phone line. The phone book is JNDI since the datasource you created can be looked up in the JNDI directory. SessionFactory is a lawyer that knows what his clients want (mapping objects ot database) and wanting to use the datasource phone line in order to send/store the message.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 29, 2005 3:55 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
You will never be able to explain such a concept to a person who has no technical knowledge. If it is a person who knows Java technology, explaining "this is a configuration object at runtime and this is a database connection" should be no problem. Or you can just give up, because if that is not understood, there is not much hope for anything else.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 29, 2005 4:32 pm 
Newbie

Joined: Fri Jul 15, 2005 9:30 am
Posts: 13
Well, he is a client and giving up would be very bad. :-(
Nevertheless, thanks for your input


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 7 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.