<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <br>
    I will answer my own question <br>
    It is supported out of the box   in
    <meta http-equiv="content-type" content="text/html; charset=utf-8">
    <pre style="background-color:#ffffff;color:#000000;font-family:'DejaVu Sans Mono';font-size:9.0pt;">org.keycloak.models.jpa.entities <meta http-equiv="content-type" content="text/html; charset=utf-8">UserEntity <pre style="background-color:#ffffff;color:#000000;font-family:'DejaVu Sans Mono';font-size:9.0pt;"></pre></pre>
    <meta http-equiv="content-type" content="text/html; charset=utf-8">
    <pre style="background-color:#ffffff;color:#000000;font-family:'DejaVu Sans Mono';font-size:9.0pt;"><span style="color:#808000;">@Table</span>(name=<span style="color:#008000;font-weight:bold;">"USER_ENTITY"</span>, uniqueConstraints = {
        <span style="color:#808000;">@UniqueConstraint</span>(columnNames = { <span style="color:#008000;font-weight:bold;">"REALM_ID"</span>, <span style="color:#008000;font-weight:bold;">"USERNAME" </span>}),
        <span style="color:#808000;">@UniqueConstraint</span>(columnNames = { <span style="color:#008000;font-weight:bold;">"REALM_ID"</span>, <span style="color:#008000;font-weight:bold;">"EMAIL_CONSTRAINT" </span>})</pre>
    Cool stuff,<br>
    George <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <div class="moz-cite-prefix">On 06/12/2015 01:07 PM, George Leon
      wrote:<br>
    </div>
    <blockquote cite="mid:557AAF5F.8050506@betiator.com" type="cite">
      <br>
      <br>
      Hi Keycloak Team ,
      <br>
      <br>
      <br>
      <br>
      Best way to add Unique constraint  to username and email in
      Keycloak ?
      <br>
      <br>
      <br>
      Best Regards
      <br>
      George Leon
      <br>
      <br>
      <br>
      <br>
      <br>
      <br>
      <br>
    </blockquote>
    <br>
  </body>
</html>