File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Blog around the Campfire and the fly likes Simple Hibernate Example with Enums Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Other » Blog around the Campfire
Bookmark "Simple Hibernate Example with Enums" Watch "Simple Hibernate Example with Enums" New topic

Simple Hibernate Example with Enums

Christopher Rygaard
Ranch Hand

Joined: Feb 22, 2014
Posts: 42
Simple Enum Example

This is the simplest stand-alone Hibernate Enum example I could cook up.

The interesting part is the annotation on MyPersistentObject._myEnum. Also notice that I don't need to register the Enum with Hibernate (eg. call addAnnotatedClass(...)).

Notice: This is provided with no warranty whatsoever. Use at your own risk.

This is the Enum:

This is the class that has an instance of the Enum:

This is how I use it:
It is sorta covered in the JavaRanch Style Guide.
subject: Simple Hibernate Example with Enums
It's not a secret anymore!