-->
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.  [ 1 post ] 
Author Message
 Post subject: Creating a sessionFactory
PostPosted: Tue Apr 19, 2005 9:10 am 
Newbie

Joined: Thu Aug 28, 2003 7:26 am
Posts: 3
I feel a bit silly asking this question because it seems like it should be obvious but none of the search terms I've used have come up with anything definite.

We have a suite of applications which used JDBC calls strewn throughout the code. The first phase was to refactor this to use DAOs and this worked well. The next phase was to replace the JDBC code with a Hibernate equivalent and to use Spring.

As a handful of the DAO classes are refactored we run a set of unit tests to make sure we haven't broken anything. These tests worked OK during the first phase using the JDBC DAOs. In the second phase of using the Hibernate DAOs we're getting MappingExceptions.

The reason for these exceptions is clear but we cannot figure out how to solve the problem.

The majority of the DAO classes are fairly atomic and know nothing about other DAOs. There are many combinations of DAOs to make any one application and, in the JDBC version, each DAO only needed the JDBC connection to bring it all together.

In the Hibernate DAO version the sessionFactory is also needed together with the necessary mappings. Although it is clear that the mappings can be specified for an application, the DAO level programmer has no idea what applications his code will be used in.

We discussed this internally and thought there must be a call to do something like; add my mappings to the sessionFactory if not already there and give me a connection. Such a call does not appear to exist.

This all worked a treat using the JDBC DAOs but seems a nightmare in Hibernate. Surely we can't be the first to come across this or are we missing something obvious?


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

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.