title: UserType join in Hibernate
body: <p>Is it possible to make hibernate do "the right thing" for some value of "right" in this situation?</p>
  
  <pre><code>from ClassA a, ClassB b
  where a.prop = b.prop
  </code></pre>
  
  <p>The thing is that prop is a UserType with different representation in the joined tables. In table A it is represented as an integer and in table B it is represented as a char. So the eq test translates to see if 1 == 'a' more or less, which is false but the object represented by 1 or 'a' should is the same so they should compare true.</p>