title: Hibernate - Custom insert into database
body: <p>I write this post to know if someone knows how to do this:</p>
  
  <p>I want to do this insert:</p>
  
  <pre><code>INSERT INTO TABLA (CAMPO1, CAMPO2) VALUES (?, crypt(?,'cdp'))
  </code></pre>
  
  <p>Crypt is a function stored in my database and the insert I would want to do it in my code. Actually when I want to insert something in the database I use:</p>
  
  <pre><code>getHibernateTemplate().persist(obj);
  </code></pre>
  
  <p>But I want to do a "custom" insert, because I need to use that function.</p>
  
  <p>I am using hibernate + annotations:</p>
  
  <pre><code>@org.hibernate.annotations.SQLInsert (sql = "INSERT INTO TABLA (CAMPO1, CAMPO2) VALUES (?, crypt(?,'cdp'))")
  </code></pre>
  
  <p>But the key 'cdp' must be readed from a file, so this solution doesn't work for me.</p>
  
  <p>I want to use a method on my code to execute a SQL query (INSERT query)</p>