-->
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: best practice question wrt accomodating various SQL dialects
PostPosted: Mon Mar 10, 2008 3:12 pm 
Newbie

Joined: Mon Mar 10, 2008 2:48 pm
Posts: 2
I am building an application using annotations and MySql as the database. As part of the testing for many classes I need to get the current time, but I'd like to write that query only once. Additionally, I have to supply MySql queries to drop, create, and populate tables. But none of them will work with other databases.

It strikes me as desirable to move all of this redundant or vendor specific SQL into some central location either in a single Java file or in a single Hibernate configuration file, so that I can switch databases, and use another vendor-specific version of this central file.

Hibernate provides some capability to define queries in a mapping file, but I am currently using only hibernate.cfg.xml with only the session-factory defined, and there does not seem to be any place to centrally define these queries in this file.

What would you recommend, a java file, Hibernate configuration file(s), or some other strategy?


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.