-->
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.  [ 5 posts ] 
Author Message
 Post subject: Finding out dialect at runtime
PostPosted: Mon Jan 29, 2007 1:02 pm 
Senior
Senior

Joined: Mon Jul 24, 2006 8:43 am
Posts: 160
Hi,
Is there any API to figure out why database or dialect I am using runtime?
The reason I ask is because my project has to support multiple types of databases and I need to write a tiny bit of custom code for each type.
Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 30, 2007 6:53 pm 
Regular
Regular

Joined: Mon Nov 14, 2005 7:33 pm
Posts: 73
A better approach might be to build a separate EJB project for each database you're going to use, this is not only a nice modular approach...but you can define a separate persistence unit for each database and specify the dialect at that level.

Otherwise, I'm not sure how you'd set multiple persistence units, dialects, and generally setup a single EJB project to point to multiple databases. It sounds like, if it grew over time, you'd have a mess on your hands.

Hope this helps.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 02, 2007 5:37 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
(SessionFactoryImplementor).getdialect() but this is a private API

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 12, 2007 1:33 pm 
Senior
Senior

Joined: Mon Jul 24, 2006 8:43 am
Posts: 160
Hi Emmanuel,
Is there any plans to make this API public?

I need to know which dialect my application is running against as it as requirement to support multiple databases and there are subtle but important differences between database.

Is there anyway I can find it out indirectly?
Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 15, 2007 7:03 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
No.
Check for the DialectFactory class, it does the discovery

_________________
Emmanuel


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