-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: Could not find a setter for property error
PostPosted: Thu Jul 22, 2004 6:14 am 
Beginner
Beginner

Joined: Mon Dec 15, 2003 5:25 am
Posts: 48
Location: Delhi, India
Hi All,

I am getting a very strange (for me) configuration time problem-
Code:
net.sf.hibernate.PropertyNotFoundException: Could not find a setter for property [b]fOrgId[/b] in class com.ao.ae.foundation.hb.FOrg


This is the table definition-

Code:
CREATE TABLE f_org(
    f_org_id             numeric(10) not null,
    f_div_id             numeric(10) not null,
    isActive             char(1)     DEFAULT 'Y' not null,
    created              timestamp   DEFAULT TIMESTAMP not null,
    createdBy            numeric(10) not null,
    updated              timestamp   DEFAULT TIMESTAMP not null,
    updatedBy            numeric(10) not null,
    name                 varchar(60) not null,
    description          varchar(255),
    f_language           varchar(6),
    check (isActive in ('Y','N')),
    CONSTRAINT f_org_pk PRIMARY KEY (f_org_id));


This is the mapping-

Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
    "-//Hibernate/Hibernate Mapping DTD 2.0//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" >
   
<hibernate-mapping package="com.ao.ae.foundation.hb">
<!--
    Created by the Middlegen Hibernate plugin

    http://boss.bekk.no/boss/middlegen/
    http://hibernate.sourceforge.net/
-->

<class
    name="FOrg"
    table="F_ORG"
>

    <id
        name="fOrgId"
        type="long"
        column="F_ORG_ID"
    >
        <generator class="assigned" />
    </id>

    <property
        name="fDivId"
        type="long"
        column="F_DIV_ID"
        not-null="true"
        length="10"
    />
    <property
        name="isactive"
        type="java.lang.String"
        column="ISACTIVE"
        length="1"
    />
    <property
        name="created"
        type="java.sql.Timestamp"
        column="CREATED"
        length="26"
    />
    <property
        name="createdby"
        type="long"
        column="CREATEDBY"
        not-null="true"
        length="10"
    />
    <property
        name="updated"
        type="java.sql.Timestamp"
        column="UPDATED"
        length="26"
    />
    <property
        name="updatedby"
        type="long"
        column="UPDATEDBY"
        not-null="true"
        length="10"
    />
    <property
        name="name"
        type="java.lang.String"
        column="NAME"
        not-null="true"
        length="60"
    />
    <property
        name="description"
        type="java.lang.String"
        column="DESCRIPTION"
        length="255"
    />
    <property
        name="fLanguage"
        type="java.lang.String"
        column="F_LANGUAGE"
        length="6"
    />

    <!-- associations -->

</class>
</hibernate-mapping>


And this is the POJO-

Code:
package com.ao.ae.foundation.hb;

import java.io.Serializable;
import java.util.Date;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;

/** @author Hibernate CodeGenerator */
public class FOrg implements Serializable {

    /** identifier field */
    private long fOrgId;

    /** persistent field */
    private long fDivId;

    /** nullable persistent field */
    private String isactive;

    /** nullable persistent field */
    private Date created;

    /** persistent field */
    private long createdby;

    /** nullable persistent field */
    private Date updated;

    /** persistent field */
    private long updatedby;

    /** persistent field */
    private String name;

    /** nullable persistent field */
    private String description;

    /** nullable persistent field */
    private String fLanguage;

    /** full constructor */
    public FOrg(long fOrgId, long fDivId, String isactive, Date created, long createdby, Date updated, long updatedby, String name, String description, String fLanguage) {
        this.fOrgId = fOrgId;
        this.fDivId = fDivId;
        this.isactive = isactive;
        this.created = created;
        this.createdby = createdby;
        this.updated = updated;
        this.updatedby = updatedby;
        this.name = name;
        this.description = description;
        this.fLanguage = fLanguage;
    }

    /** default constructor */
    public FOrg() {
    }

    /** minimal constructor */
    public FOrg(long fOrgId, long fDivId, long createdby, long updatedby, String name) {
        this.fOrgId = fOrgId;
        this.fDivId = fDivId;
        this.createdby = createdby;
        this.updatedby = updatedby;
        this.name = name;
    }

    public long getFOrgId() {
        return this.fOrgId;
    }

    public void setFOrgId(long fOrgId) {
        this.fOrgId = fOrgId;
    }

    public long getFDivId() {
        return this.fDivId;
    }

    public void setFDivId(long fDivId) {
        this.fDivId = fDivId;
    }

    public String getIsactive() {
        return this.isactive;
    }

    public void setIsactive(String isactive) {
        this.isactive = isactive;
    }

    public Date getCreated() {
        return this.created;
    }

    public void setCreated(Date created) {
        this.created = created;
    }

    public long getCreatedby() {
        return this.createdby;
    }

    public void setCreatedby(long createdby) {
        this.createdby = createdby;
    }

    public Date getUpdated() {
        return this.updated;
    }

    public void setUpdated(Date updated) {
        this.updated = updated;
    }

    public long getUpdatedby() {
        return this.updatedby;
    }

    public void setUpdatedby(long updatedby) {
        this.updatedby = updatedby;
    }

    public String getName() {
        return this.name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getDescription() {
        return this.description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getFLanguage() {
        return this.fLanguage;
    }

    public void setFLanguage(String fLanguage) {
        this.fLanguage = fLanguage;
    }

    public String toString() {
        return new ToStringBuilder(this)
            .append("fOrgId", getFOrgId())
            .toString();
    }

    public boolean equals(Object other) {
        if ( !(other instanceof FOrg) ) return false;
        FOrg castOther = (FOrg) other;
        return new EqualsBuilder()
            .append(this.getFOrgId(), castOther.getFOrgId())
            .isEquals();
    }

    public int hashCode() {
        return new HashCodeBuilder()
            .append(getFOrgId())
            .toHashCode();
    }

}


I can see a setter for property fOrgId in class com.ao.ae.foundation.hb.FOrg.

Can anybody point out what is wrong there.

Hibernate 2.1.4

_________________
Vinod K. Singh


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 22, 2004 8:25 am 
Beginner
Beginner

Joined: Thu Jun 24, 2004 1:04 pm
Posts: 35
Location: Minnesota - USA
Just a guess, it might be an issue with the property name. You've got 2 capital letters at the beginning of the getter method 'getFOrgId()'. A quick scan of the Hibernate source finds it using:

http://java.sun.com/j2se/1.3/docs/api/j ... ang.String)

on the methods it finds on the class. Perhaps change your mapping to use the name of the property as 'FOrgId' might work.

--gus


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 23, 2004 2:09 am 
Beginner
Beginner

Joined: Mon Dec 15, 2003 5:25 am
Posts: 48
Location: Delhi, India
Thanks gus,

your guess worked.

_________________
Vinod K. Singh


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.