title: Generate environment aware encryption logic with Hibernate and EncryptedString class
body: <p>Hibernate encryption is very useful, on production, but during test/dev process, I would like to optionally turn it off. </p>
  
  <p>Currently, we annotate our code as the following, </p>
  
  <pre><code>@Type(type = "encryptedString")
  public String getExpirationMonth() {
      return expirationMonth;
  }
  </code></pre>
  
  <p>and we have a definition on the type with </p>
  
  <pre><code>@TypeDef(
      name="encryptedString", 
      typeClass=EncryptedStringType.class, 
      parameters= {
          @Parameter(name="encryptorRegisteredName", value="hibernateStringEncryptor")
      }
  ),
  </code></pre>
  
  <p>I was hoping that I can subclass of EncryptedStringType, where I can make our code environment aware.<br>
  Unfortunately, EncryptedStringType is final. </p>
  
  <p>How would you approach this issue? </p>