1 Reply Latest reply on Feb 29, 2008 7:31 PM by jimk1723

    Need help with dynamic data structure bean

    mrbiggles

      Hello,



      I'm trying to write a data structure bean to represent some dynamic data not known at compile time. E.g. a user object with some fixed attributes (login, name, ...) and a collection of key/value pairs set a run time. I would like to use this dynamic bean in Seam/Hibernate.



      I came up with the following design (Java pseudo code):


      
      
      @Entity
      
      class BeanProperty {
      
           String propName;
      
           String propValue;
      
      }
      
      
      
      @Entity
      
      class BeanUser {
      
           String login;
      
           String name;
      
      
           @OneToMany
      
               @MapKey(propName)
      
           Map<String, BeanProperty> propertiesMap;
      
      }
      
      
      



      Since I'm totally new to this topic I'm not sure wheter this is the way to go. Unfortunatly I could not find any examples about this. So I would be very happy if you could give me some hints and also some example code. Also I would be very happy about some predefined SQL statments to include in the import.sql file in order to get the database filled with some data.



      Thanks a lot, Biggles