title: how to model a singleton object to table through hibernate?
body: <p>I have a global config object in my project and there can ever be 0 or 1 instance of this class that i want to persist in db. What is the  best way to do this ? One trick i know here is to have a "constant" field mapped with unique constraint set on it, are there other such ways as this looks a little hacky ?<br/><br/>
  Here's what i tried :- <br/></p>
  
  <pre><code>    @Entity
      public class DTLdapConfig implements Serializable {
  
          @GeneratedValue(strategy=GenerationType.TABLE)
          @Id
          private int id;
  
          @Column(unique=true)
          private boolean singletonGuard;
  
   // no public setter getter for singletonGuard
  
   // other code below
  
  }
  </code></pre>