I don't know how to answer your question. In SQL, the padded and unpadded values are equivalent, as you are aware, but in Java, when you retrieve the value of the char(5) column, you get back the padded value. Hibernate does the discriminator value comparisons in Java.
Hibernate's behavior may not be what you want, but I don't really see a problem with it. By using a fixed-width type, semantically you're saying that the values should be of fixed width, so it seems reasonable to me that the discriminator values should be, too.
If it bothers you too much, I think you could use a user type for the discriminator column - at least, the code seems to support it, although I didn't look into how to configure it, or even if it's possible to do so.
|