1 Reply Latest reply on Dec 3, 2001 2:00 PM by Dain Sundstrom

    CMP2 and complex container-managed fields

    Pedro Garcia Lopez Newbie

      Hi all,

      In the new CMP2, all accesor methods to container-managed fields must be declared abstract.
      For simple variables there is no problem but for composite variables I cannot imagine how can you do it.

      For example, you have a Map field with methods:

      setProperty(String key, String value)
      getProperty(String key)
      addProperty(String key, String value)
      removeProperty(String key)

      How this can be solved with abstract methods ?
      Is the container so clever to fill this code ?

      Thank you in advance.


        • 1. Re: CMP2 and complex container-managed fields
          Dain Sundstrom Master

          First off this should be in the persistence forum.

          You thinking in object land. How would JBossCMP map this type of property to a set of columns? It can't, but it could use a map table that has a name column and a value column.

          Ok, you need another table, so you need another bean. Create MapEntryEJB with only a local interface, and name and value columns. Then setup a one-to-many relationship between YourEJB and MapEntiyEJB.