Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2008
    Posts
    4

    Unanswered: Problem with HIbernate and DB2

    Hello Folks,

    I have a problem with HIbernate mapping and DB2. Maybe you can help me. Here ist the Exception:
    org.hibernate.PropertyAccessException: IllegalArgumentException occurred while calling setter of de.dcfs.quest.model.dataobjects.RVarRegions.actSta tus

    The other files are attached to this Thread and If you need more details, please let me know.

    Thanks in adavance!

    Best Regards,
    Kafftarbaz
    Attached Files Attached Files

  2. #2
    Join Date
    Sep 2004
    Location
    Belgium
    Posts
    1,126
    Quote Originally Posted by kafftarbaz
    /*
    The next step throws this Exception!!!!!!!!
    org.hibernate.PropertyAccessException: IllegalArgumentException occurred while calling setter of de.dcfs.quest.model.dataobjects.RVarRegions.actSta tus
    */
    result = session.createQuery(
    "from RVarRegions where actStatus <> 1 ")
    .list();
    Try changing this to
    Code:
    result = session.createQuery(
    "select * from RVarRegions where actStatus <> 1 ") .list()
    just to see if that "solves" the problem (or at least shifts the error to some lines further down).
    If so, you will probably have to replace the added "*" by something more specific...
    --_Peter Vanroose,
    __IBM Certified Database Administrator, DB2 9 for z/OS
    __IBM Certified Application Developer
    __ABIS Training and Consulting
    __http://www.abis.be/

  3. #3
    Join Date
    Sep 2004
    Location
    Belgium
    Posts
    1,126
    Quote Originally Posted by Peter.Vanroose
    Code:
    result = session.createQuery(
    "select * from RVarRegions where actStatus <> 1 ") .list()
    Actually, from the table definition, it seems like it should even be rather something like:
    Code:
    result = session.createQuery(
    "select * from R_Var_Regions where act_Status <> 1 ") .list()
    --_Peter Vanroose,
    __IBM Certified Database Administrator, DB2 9 for z/OS
    __IBM Certified Application Developer
    __ABIS Training and Consulting
    __http://www.abis.be/

  4. #4
    Join Date
    Jan 2008
    Posts
    4
    Hello Folks,

    thank a lot for your helps and advices:

    The solution was:
    A) I changed the HQL-Statement to:
    result = session.createQuery("select rvr from RVarRegions rvr where actStatus <> 1 ").list();

    B) I changed in the Java-File the datatype from java.lang.Long to java.math.BigDecimal:

    public class RVarRegions implements java.io.Serializable {
    private BigDecimal actStatus;
    private BigDecimal companyId;

    public BigDecimal getActStatus() {
    return this.actStatus;
    }

    public void setActStatus(BigDecimal actStatus) {
    this.actStatus = actStatus;
    }

    public BigDecimal getCompanyId() {
    return this.companyId;
    }

    public void setCompanyId(BigDecimal companyId) {
    this.companyId = companyId;
    }
    }

    C) Also the database driver is now changed from "COM.ibm.db2.jdbc.app.DB2Driver" to "com.ibm.db2.jcc.DB2Driver"

    D) Changes in the config file of hibernate hibernate.cfg.xml
    <property name="hibernate.bytecode.use_reflection_optimizer" >true</property>
    ...
    <property name="hibernate.connection.driver_class">com.ibm.d b2.jcc.DB2Driver</property>


    Thanks again for your helps & advices


    Best Regards,
    Kafftarbaz :-)

Posting Permissions

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