2 Replies Latest reply on Dec 8, 2006 12:28 PM by gustav3d

    EnumSet mapping

    rwallace

      What's the best way to map an EnumSet in EJB3?

      What I'd like is for the EnumSet to map to a single column in the table, something like a bit vector, which is how EnumSets are implemented internally (according to the javadoc at least). That way, it's not off in some other table and loading it doesn't add any extra overhead and querying it is relatively simple.

      Any way to accomplish all that or should I just stick with a regular set for now?

      Thanks,
      Rich

        • 1. Re: EnumSet mapping
          epbernard

          Check the unit test suite of hibernate annotations
          org.hibernate.test.annotations.collectionelement.Boy

          • 2. Re: EnumSet mapping
            gustav3d

            hello,

            There is currently no support for using EnumSet natively in an entity for HB.

            are there any plans to fix that ? (i cant find anything in the JIRA issue tracking).

            it would be nice to have out of the box support for EnumSet stored as its bit values from ordinal() in a compact manner in the DB =)

            The RI for JPA , toplink ess. currently has this feature also missing,
            but its to be fixed:

            https://glassfish.dev.java.net/issues/show_bug.cgi?id=1574


            On a broader perspective , it would be convenient if code running on the RI for the spec , could be used on other JPA implementations without the need for writing usertype classes etc ?.

            if i can somehow assist regarding this matter, i would gladly do so.

            best regards
            Gustav Trede