Results 1 to 2 of 2

Thread: Domain attributes are not writable if extended from class

  1. #1
    Join Date
    Jun 2005
    Location
    San Mateo, CA
    Posts
    34

    Default Domain attributes are not writable if extended from class

    Has anyone experienced class attributes that are silently not written to?

    I have a super class called:

    Code:
    public class BaseSystem {
      protected String rowid;
    
      public void setRowId(String rowId) {
        this.rowid = rowId;
      }
      public String getRowId() {
        return this.rowId;
      }
    }
    
    public class Company extends BaseSystem implements Serializable {
      private String companyName;
      public void setCompanyName(String name) {
        this.companyName = name;
      }
      
      public String getCompanyName() {
         return this.companyName;
      }
    }
    Now when in my sqlmap file I have

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http&#58;//www.ibatis.com/dtd/sql-map-2.dtd">
    
    <sqlMap namespace="Company">
      <insert id="addCompany">
        insert into company &#40;rowid, name&#41;
        values &#40;#rowId#, #companyName#&#41;
      </insert>
    </sqlMap>
    In my DAO implementation I have

    Code:
    public class SqlMapCompanyDao extends SqlMapClientDaoSupport implements CompanyDao &#123;
      public void addCompany&#40;Company company&#41; &#123;
        getSqlMapClientTemplate&#40;&#41;.insert&#40;"addCompany", company&#41;;
      &#125;
    &#125;
    However when I try to read/write the rowid I always get a null. I can read/write the company name, but the rowid seems to always be null. Is this configuration unsupported? Does my Company object need to explicitly specify the rowid instead of inheriting it from Base??

    Any help would be appreciated.

  2. #2
    Join Date
    Jun 2005
    Location
    San Mateo, CA
    Posts
    34

    Default stupid stupid

    Rrrr!! I forgot to implement the Serializable in the Base class!! That was why..

Similar Threads

  1. Order of Bean definitions matters?
    By cfuser in forum Container
    Replies: 2
    Last Post: Oct 21st, 2005, 10:29 AM
  2. Replies: 2
    Last Post: Oct 10th, 2005, 05:12 PM
  3. EHCaching Hibernate
    By dencamel in forum Data
    Replies: 3
    Last Post: Sep 6th, 2005, 09:03 PM
  4. Replies: 3
    Last Post: Sep 4th, 2005, 11:11 PM
  5. Stack Overflow
    By rayho222 in forum Container
    Replies: 6
    Last Post: May 17th, 2005, 03:42 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •