I am using couple native SQLs queries in Hibernate3. Right now I have kept them into Java file. But my boss told me that if there is any change into queries then you would need to change the query,compile Java file and restart the server. Which is not desirable in production server at client end. So he asked me to keep it in properties file so that you don't need to restart the server. I just want to know that is this the correct way to do it? How do you do that?
sorry iam newbie.. your question is made me to do good design..
sorry maybe i need some suggestions about :
what kind of Hibernate do you use?..
is it Hibernate Annotation?, and How to save the queries in the properties file?..
do you use XML mapping file?..
is it possible to change the queries in XML Mapping file, while running time?..
Thanks in advance...
Sorry, perhaps my english language isn't too good.. Prepare for SCJP 6, Please God help me.. ☼
References : [Java.Boot] [JavaChamp] [JavaPrepare]
I'm a big fan of Hibernate with JSP Annotations, but sometimes there is a case to be made for one hibernate-config.xml file that contains all of your mappings in a single place. To each his own, as they say.
Expecting to change the SQL at runtime might be a little too much. For extremely flexible queries, use the Hibernate Criteria API. I pulled a little bit out of my book on Hibernate and put it on my website. You should take a look if you want to learn more about the Criteria API: