@ManyToMany import ArrayCollection missing

DTO2Fx
Anonymous
2011-01-25
2013-04-29

  • Anonymous
    2011-01-25

    I recently upgraded from an older version and have noticed that where I have used the @ManyToMany annotation DTO2FX is no longer adding the "import mx.collections.ArrayCollection;" to the generated AS file.

    Working in com.farata.dto2fx.asap_3.1.0.20090225034925.jar
    Broken in com.farata.dto2fx.asap_3.2.2.20100901123043.jar
    
     
  • Please notice that it adds import of mx.collections.ICollectionView instead.

    WBR,
    Victor

     

  • Anonymous
    2011-02-14

    Thanks for replying Victor.

    I have only just seen your reply. I am puzzled by your response though. I have regenerated the AS classes and I cannot see the import you mention. Here is the generated file ( I have just left in the relevant details)

    package com.twoh.dto.generated {
        
      import com.twoh.dto.BaseEntity;
      import com.twoh.dto.BuildingType;
      import com.twoh.dto.JobStatusType;
      import com.twoh.dto.JobType;
      import com.twoh.dto.BaseEntity;
      import flash.utils.Dictionary;
      
      /* [ExcludeClass] */
      public class _Job extends com.twoh.dto.BaseEntity {
      
        /* Constructor */
        public function _Job():void {
          super();
        }   
        
        [Transient]
        override public function get properties():Dictionary {                   
          var properties:Dictionary = super.properties;   
          properties["departments"] = this.departments;
          return properties;
        }    
        
        override public function set properties(properties:Dictionary):void {
          super.properties = properties;
          this.departments = properties["departments"];
        }    
        override public function toXML():XML {
          var xml:XML = super.toXML();
          xml.appendChild(<departments>{this.departments}</departments>);
          return xml;    
        }
        
        /* Property "departments" */
        private var _departments:mx.collections.ArrayCollection;
        
        [Bindable(event="propertyChange")]
        public function get departments():mx.collections.ArrayCollection {
          return _departments;
        }
        public function set departments(value:mx.collections.ArrayCollection):void {
          const oldValue:mx.collections.ArrayCollection = this._departments;
          if (oldValue != value) {
            this._departments = value;
            dispatchUpdateEvent("departments", oldValue, value);            
          }
        }
        
      }
    }
    
     

  • Anonymous
    2011-02-14

    And here's the relevant section from the Java DTO

    @SuppressWarnings("unchecked")
        @ManyToMany
        @JoinTable(name="edrdepartmentjoblink", joinColumns= {@JoinColumn(name="job_id")}, inverseJoinColumns={@JoinColumn(name="department_id")})
        List<Department> departments = new Vector();
        public List<Department> getDepartments() { return departments; }
        public void setDepartments(List<Department> departments) { this.departments = departments; }
    
     

  • Anonymous
    2011-02-15

    I have just tried the very latest version of the DTO2FX jar I can find on the site (com.farata.dto2fx.asap_4.1.0.201011291455.jar from the download site_20101129-1456.zip) and the results are the same. The generated file creates properties of type mx.collections.ArrayCollection but does not add the corresponding import. The workaround is to manually add the required import to the generated file, but it does kinda defeat the object.

    Am I doing something wrong, can anyone suggest a solution ?

     

  • Anonymous
    2011-02-15

    Ok, big apologies.

    It would appear that com.farata.dto2fx.asap_4.1.0.201011291455.jar DID fix the problem. The generated file being viewed in the Eclipse IDE did not reflect the contents of the generated file on disk (despite having refreshed and closed/opened the file!). I only spotted the changes when I did an SVN diff with the previous checkin.

    package com.twoh.dto.generated {
        
      import com.twoh.dto.BaseEntity;
      import com.twoh.dto.BuildingType;
      import mx.collections.ArrayCollection;
      import com.twoh.dto.Department;
      import com.twoh.dto.JobStatusType;
      import com.twoh.dto.JobType;
      import com.twoh.dto.BaseEntity;   
      import flash.utils.Dictionary;
      import mx.core.IUID;
      
      /* [ExcludeClass] */
      public class _Job extends com.twoh.dto.BaseEntity implements 
              mx.core.IUID {
        /* Constructor */
        public function _Job():void {
          super();
        } 
        [Transient]
        override public function get properties():Dictionary {                   
          var properties:Dictionary = super.properties;   
          properties["departments"] = this._departments;