title: Store Class object in MySQL database via Hibernate
body: <p>I use Hibernate version 3.6. I have to store <code>Class</code> instance in database (e.g. <code>Integer.class</code>)
  and probably i can do it - NetBeans dont show error as in case of <code>Object</code>.</p>
  
  <p>My <code>Groups</code> table: </p>
  
  <pre><code>@Entity
  public class Groups implements Serializable {
  
      @Id
      @GeneratedValue
      private Long id;
      private Class classOfGroup;
  
      public void setClassOfGroup(Class classOfGroup) {
          this.classOfGroup = classOfGroup;
      }
  
      public Class getClassOfGroup() {
          return classOfGroup;
      }
  
      private void setId(Long id) {
          this.id = id;
      }
  
      public Long getId() {
          return id;
      }
  }
  </code></pre>
  
  <p>And <code>AdditionalInformationGroup</code> table:</p>
  
  <pre><code>@Entity
  public class AdditionalInformationGroup implements Serializable {
  
      @Id
      @GeneratedValue
      private Long id;
      private Class groupClass;
      private Boolean uniqueValue;
  
      public void setUniqueValue(Boolean uniqueValue) {
          this.uniqueValue = uniqueValue;
      }
  
      public Boolean getUniqueValue() {
          return uniqueValue;
      }
  
      public void setGroupClass(Class groupClass) {
          this.groupClass = groupClass;
      }
  
      public Class getGroupClass() {
          return groupClass;
      }
  
      private void setId(Long id) {
          this.id = id;
      }
  
      public Long getId() {
          return id;
      }
  }
  </code></pre>
  
  <p>When I do this:</p>
  
  <pre><code>List&lt;AdditionalInformationGroup&gt; additionalInformationGroups = 
  s.createCriteria(AdditionalInformationGroup.class)
  .add(Restrictions.eq("groupClass", group.getClassOfGroup())).list();
  </code></pre>
  
  <p>i got Exception:</p>
  
  <pre><code>Exception in thread "AWT-EventQueue-0" org.hibernate.QueryException: Unsupported discriminator type null
      at org.hibernate.loader.criteria.CriteriaQueryTranslator.getTypedValue(CriteriaQueryTranslator.java:499)
      at org.hibernate.criterion.SimpleExpression.getTypedValues(SimpleExpression.java:71)
      at org.hibernate.loader.criteria.CriteriaQueryTranslator.getQueryParameters(CriteriaQueryTranslator.java:251)
      at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:94)
      at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1569)
      at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:283)
      at Views.ConditionDialog.setFieldList(ConditionDialog.java:85)
  </code></pre>
  
  <p>I checked that, there is no null at my instance of <code>Groups</code> class. Have i got a bug here, or i can't store instance of <code>Class</code> via hibernate?</p>