• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Keeping SQL Out of Code

 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So Hibernate and other O/R's aside, what methods do you use for keeping SQL from being hard coded? I've seen XML files used, .sql files, properties files....

Any success stories, so to speak?
 
Shailesh Chandra
Ranch Hand
Posts: 1082
Java Oracle Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I always prefer keeping sql in xml files.afterwards I cache the sql queries in singleton class.

If any time SQL changes only server need to restarted, even if we put sql in java classes(DAO) then also server is required to restart.

But free I am anytime free to use strength of database specific feature,and I can manage things even remotely by changing xml files, no compilation is required.

thanks..
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the information.
 
pascal betz
Ranch Hand
Posts: 547
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how about ibats.com SQLMaps ?
a framework to store the SQL stuff in XML files (and yes, it does some O/R mapping)

pascal
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by pascal betz:
how about ibats.com SQLMaps ?
a framework to store the SQL stuff in XML files (and yes, it does some O/R mapping)

pascal


I've looked (and am looking) at that. It is an option. I'm just not sure if it would be just as easy to roll my own. They did just release a new version so at least I know they are still developing it.
 
Shailesh Chandra
Ranch Hand
Posts: 1082
Java Oracle Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
pascal,

would you share some link where we can find more information ?

thanks
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
http://www.ibatis.com/
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic