title: How to Ignore Certain Fields in unit tests, Hibernate
body: <p>I have the following field in my entity model. </p>
  
  <pre><code>@Column(name="key")
  @ColumnTransformer(
          read="AES_DECRYPT(key, SHA1('passcode'))", 
          write="AES_ENCRYPT(?, SHA1('passcode'))")
  private String secret_key;
  </code></pre>
  
  <p>I am using MySql database and hibernate will perfectly encrypt/decrypt the key value with AES_ENCRYPT and AES_DECRYPT function. However, the spring embedded databases (HSQL or H2) doesn't know about this specific MySql functions. It throws the following error:</p>
  
  <pre><code> javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not insert: [com.xxx.Table]
      at ...
  
  Caused by: org.hibernate.exception.SQLGrammarException: could not insert: [com.xxx.Table]
      at ...
  
  Caused by: java.sql.SQLSyntaxErrorException: user lacks privilege or object not found: AES_ENCRYPT
  </code></pre>
  
  <p>So my question is, </p>
  
  <ol>
  <li>How can I tell hibernate to ignore this field from writing in certain databases. OR</li>
  <li>How can I get HSQL and/or H2 work with this mysql function. </li>
  </ol>
  
  <p>Thank you</p>