Hibernates is generating a VARBINARY column with JPA @Enumerated annotation. I’m using SQL Server 2005 w/ JTDS driver. The mapping is dirt simple:
@Basic
@Enumerated(EnumType.ORDINAL)
private MyEnum foo;
I would have expected Hibernate to generate an integer column? I’ve also tried EnumType.STRING (expecting a varchar column) with no success.
Note that my app works fine; the column type makes it hard to inspect the DB, and to issue adhoc SQL when poking at the database.
It was a stupid user error. Contrary to what I posted in my question, I messed up the “dirt simple” mapping. Instead of declaring my member variable as MyEnum, I instead had this:
Well of course Hibernate had to store binary data, since I told it I wanted to store arbitrary enum values. Changing the type of foo to MyEnum “fixed” the problem.