-->
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: Annotations & Core - Can't add DataSource programmatical
PostPosted: Thu Apr 26, 2007 5:41 pm 
Newbie

Joined: Thu Feb 03, 2005 9:19 pm
Posts: 11
Location: Bedford, TX
I am very green in Hibernate, but it seems that there is no way to pass a DataSource object directly to the Hibernate configuration (Configuration, AnnotationConfiguration, etc.). I cite this as a shortcoming creating unnecessary limitations.

I may not want to use JNDI in my project, but this would force me to acquire a JNDI provider to pass my own DataSource to Hibernate. I realize there are work-arounds (i.e., using Hibernate's DBCP), but I'm talking about the optimum solution.

Are there any current initiatives to implement this or conflicts of some type that would (or should) inhibit this functionality?

Hibernate version: 3.2.3
Hibernate Annotations version: 3.3.0 GA

Thanks,
Daniel


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 27, 2007 4:31 pm 
Red Hat Associate
Red Hat Associate

Joined: Mon Aug 16, 2004 11:14 am
Posts: 253
Location: Raleigh, NC
From the manual, section 3.3:

Quote:
You may define your own plugin strategy for obtaining JDBC connections by implementing the interface org.hibernate.connection.ConnectionProvider. You may select a custom implementation by setting hibernate.connection.provider_class.


http://www.hibernate.org/hib_docs/v3/re ... ernatejdbc

Usually if you're using a DataSource, it comes from JNDI or you're using something like Spring to create it. If not, you can create a ConnectionProvider and do anything you want.

-Chris


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.