1 Reply Latest reply on May 13, 2002 7:29 PM by dsundstrom

    Basic: BLOB persistence of dependent value classes

    rfrey

      I'm having some trouble with a CMP field that is a HashMap storing String:String pairs. I'm sure it's something straightforward, but apparently too complex for me anyhow.

      I've got the following lines in my Local interface:

      public String getWebsetting(String name) throws EJBException;
      public void setWebsetting(String name, String websetting) throws EJBException;

      In my implementation class I have these methods:

      public String getWebsetting(String name) {
        HashMap hm = getWebsettings();
        String value = (String)hm.get(name);
        if(value == null) return "";
        return value.trim();
      }
      public void setWebsetting(String name, String websetting) {
        HashMap hm = getWebsettings();
        hm.put(name.trim(), websetting.trim());
        setWebsettings(hm);
      }
      public abstract HashMap getWebsettings();
      public abstract void setWebsettings(HashMap hm);

      My ejb-jar.xml file includes "websettings" as a cmp-field, but there is no reference to this bean in the jbosscmp-jdbc.xml descriptor.

      Deploying the bean results in a BLOB column being created called "websettings". Good. When I call setWebsetting(String, String) on the local interface, it works. Good. If I call getWebsetting(String) from WITHIN the initial call to setWebsetting, results are as expected. But if I call getWebsetting from the client, against the same instance of the local interface, the HashMap is empty. In other words, the change to the hashmap cmpfield only seems to take effect during the scope of the setWebsetting call.

      Am I missing a configuration detail?

      Thanks!