<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>

(1) Change data-type of columns which map to "prop" to be the same. This will require "Making DBA your friend" but will result in consitent "prop" UserType usage.
(2) Handle the type differences in equals() method
```
```
public boolean equals(Object x, Object y) throws HibernateException {
    boolean retValue = false;
    if (x == y) retValue = true;

    if (x!=null && y!=null){
        Character xChar = new Character(x);
        Character yChar = new Character(y);
        if (xChar.equals(ychar)){
            retValue = true;
        }
    }

    return retValue;
}
```
```