title: Where should I put the SQL files in my Java project?
body: <p>I have a Java project which will include a number of large SQL statements for querying the  database.  My question is: where should I store them?</p>
  
  <p>I'm fairly sure I want each statement its own text file managed by source code control.  As Java doesn't support multi-line strings I can't easily put the SQL in my <code>.java</code> files and I don't think I'd want to anyway.  At build time I can put these text files in JAR and get the contents with <a href="http://java.sun.com/javase/6/docs/api/java/lang/ClassLoader.html#getResourceAsStream%28java.lang.String%29" rel="noreferrer"><code>ClassLoader.getResourceAsStream()</code></a>.</p>
  
  <p>So my problem becomes in which directories should I put these files and what should I call them.  Ideally I'd like people to tell from the <code>.sql</code> file which Java class uses it.  What I definitely don't want is a single directory full of lots of files called things like <code>report1.sql</code> and <code>report3.sql</code> and so on.</p>
  
  <p>My inclination is to put them in the package directory with all the <code>.java</code> files but I have a colleague who doesn't like having anything other than <code>.java</code> files in this tree.  So this leads to alternative of a separate directory structure which mirrors the Java packages but this seems like an unnecessary overhead.  </p>
  
  <p>So I would be interested to hear what you do with your SQL files.</p>
  
  <p>We're using Netbeans 6.5 in case that will affect your answers.</p>
  
  <p>(<a href="https://stackoverflow.com/questions/576571/where-do-you-put-sql-statements-in-your-c-projects">This question</a> is similar but sadly the answers are very C# specific, which is good for that question but bad for me.)</p>