0 Replies Latest reply on Dec 31, 2006 4:05 AM by smokingapipe

    Customizing the persistence of an embedded object

    smokingapipe

      Simple question: I have a class that uses an embedded object that's not an entity, like this:

      @Entity
      public class LogMessage {
       private java.util.logging.Level level;
      }
      


      Right now, the way that handles it is it creates a bytea column to store the level. Of course that's not what I want. What would be ideal would be to somehow annotate it so I could define my own persistence for that particular field. In this case, I would want to persist it as either an integer or a string perhaps. I know in Hibernate it wasn't a big deal to write my own custom type with its own storage approach but I can't find anything like that in EJB3. Any ideas?

      Of course the other thing i can do is to just write up my own enum and not even use the java.util.logging.Level class, but hey, that class is there and does exactly what I want so it would be ideal to use it.

      Thanks for any ideas on this