3 Replies Latest reply on Sep 22, 2005 10:11 AM by Chris Hornsey

    SecondaryTable to map an array attribute ot a class.

    Chris Hornsey Newbie

      In Hibernate 3 defining a class with an array could be mapped quite easily.

      Lets say I have the following class

      public class Entity
      private int ID;
      private String val1;
      private String val2;
      private String val3;
      private String[] codes;
      ........

      The following tables are used to persist this class:
      ENTITY
      ID int,
      val1 VARCHAR(25),
      val2 VARCHAR(25),
      val3 VARCHAR(25),

      ENTITYCODES
      ENTITY_ID int (FK to ENTITY.ID),
      Code VARCHAR(5)

      Mapping this in hibernate thrree is very simple this is an example config file for Entity:






      I thought I could use the SecondayTable annotation in EJB3 to accomplish the same thing. Does anyone know how to accomplish this type of mapping with EJB3 annotations?