gavin wrote:
Yes, use a UserType
The only drawback in this approach is that you won't be able to write something like:
Code:
Query q = s.createQuery("from Address a where a.continent=:continent");
q.setEnum("continent", Continent.EUROPE);
as you would do with Hibernate enums.
As Continent are not Entities (regarding Hibernate's nomenclature), the only solution seems to be:
Code:
q.setString("continent", Continent.EUROPE.getPersistentValue());
Hence re-introducing a dependency to the persistence. Although this is a minor issue in this case, the Hibernate Enum approach was a nicer solution...