Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    #16
    Sorry forgot to include that my objects have a default (implicit) no-args constructor and no exceptions.

    Comment


      #17
      Auto-construction in JXPath works by reflection, so try adding an explicit constructor.

      Comment


        #18
        We're using JAXB to generate the beans. While searching the internet for ways to add an explicit constructor, many people say that it's not possible or very complicated. I may look into it later after our deadline.

        However, I did try using reflection (two different ways) to construct my inner beans from their implicit constructors then set them in my the containing bean and setProperties() worked correctly. Is there another way you're using reflection to construct the inner beans or could it be something else?

        Here is what I did:
        Code:
        //Common common = new Common();
        Common common = Common.class.newInstance();
        common.setName(Name.class.getConstructor().newInstance());
        
        Plan plan = new Plan();
        plan.setCommon(common);
        
        DataSource ds = DataSourceManager.get("planDMI");
        ds.setProperties(dsRequest.getValues(), plan);
        
        // XPath is /common/name/name
        System.out.println(plan.getCommon().getName().getName());
        Thanks!

        Comment


          #19
          We're using JXPath - most likely the limitation here is that JXPath won't create intervening objects with an implicit constructor.

          In a future version we'll be taking over this part of the process from JXPath since it seems to do it poorly - no ETA, but you could sponsor the feature to have it done by a specific date.

          Comment

          Working...
          X