0 Replies Latest reply on Mar 18, 2009 12:41 PM by bryan.kearney

    Approach for mappng a properties table

    bryan.kearney

      I am looking for advice on how to map a properties table. Assume a schema such as:

      Objects_Table
      ObjectID
      ObjectName
      ObjectType

      Properties_Table
      ObjectID
      PropertyID
      PropertyValue

      Assuming that for OID 12 there are 2 properties (NAME and Description) I would like to map a class which looks like

      ClassA
      - getName()
      - setName()
      - getDescription()
      - setDescription()

      I have looked at two approaches for this, and was curious if there was other:

      First: Map Objects_Table to ClassA, and give it a relatioship of Properties (@OneToMany). Then, hand craft the getters and setters to manage the properties. This works fine, but searching will be a bit sketchy to code.

      Second: Map both tables to ClassA using customer @Loader and @SqlInsert commands. These in turn are backed by heavily joined queries and/or stored procedures. This hides the underlieing tables (good) but requires lots of hand crafted SQL code.

      Are there other approaches to this?

      -- bk