This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Object Relational Mapping and the fly likes PropertyNotFoundException in Hibernate Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "PropertyNotFoundException in Hibernate" Watch "PropertyNotFoundException in Hibernate" New topic
Author

PropertyNotFoundException in Hibernate

chundottu jacob
Greenhorn

Joined: Mar 13, 2006
Posts: 7
Hi,

I am getting the following error:

net.sf.hibernate.PropertyNotFoundException: Could not find a getter for deleteInd in class .......

when the page is being loaded. I have defined the property "deleteInd" in the .hbm.xml file as well as added set()/get() methods for the same. Please advise as to what could be the cause of the error.

Given below are the necessary details:

Hibernate version: 2.0

Mapping documents:
MtUuidLink.hbm.xml
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" >

<hibernate-mapping>
<!--
Created by the Middlegen Hibernate plugin 2.1

http://boss.bekk.no/boss/middlegen/
http://www.hibernate.org/
-->

<class name="sg.gov.ciris.entity.MtUuidLink" table="MT_UUID_LINK">
<id
name="linkedUuid"
type="java.lang.Long"
column="LINKED_UUID"
>
<generator class="assigned" />
</id>
<version name="version" column="VERSION" type="java.lang.Long"/>
<property
name="activeUuid"
type="java.lang.Long"
column="ACTIVE_UUID"
not-null="true"
length="14"
/>
<property
name="activeId"
type="java.lang.String"
column="ACTIVE_ID"
not-null="true"
length="9"
/>
<property
name="linkedId"
type="java.lang.String"
column="LINKED_ID"
not-null="true"
length="9"
/>
<property
name="deptCd"
type="java.lang.String"
column="DEPT_CD"
length="7"
/>
<property
name="linkedTy"
type="java.lang.String"
column="LINKED_TY"
not-null="true"
length="1"
/>
<property
name="createBy"
type="java.lang.String"
column="CREATE_BY"
insert="true"
update="false"
not-null="true"
length="9"
/>
<property
name="createDt"
type="java.sql.Timestamp"
column="CREATE_DT"
insert="false"
update="false"
not-null="true"
length="7"
/>
<property
name="updBy"
type="java.lang.String"
column="UPD_BY"
insert="true"
update="true"
not-null="true"
length="9"
/>
<property
name="lastTimestp"
type="java.sql.Timestamp"
column="LAST_TIMESTP"
not-null="true"
insert="false"
update="true"
length="11"
/>
<property
name="deleteInd"
type="java.lang.String"
column="DELETE_IND"
insert="false"
update="true"
not-null="true"
length="1"
/>

<!-- Associations -->
</class>
</hibernate-mapping>

My entity class is defined as follows:
public class MtUuidLink implements Serializable {

/** identifier field */
private Long linkedUuid;


/** persistent field */
private Long activeUuid;


/** persistent field */
private String activeId;


/** persistent field */
private String linkedId;


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


/** persistent field */
private String linkedTy;


/** persistent field */
private String createBy;


/** persistent field */
private Date createDt;


/** persistent field */
private String updBy;


/** persistent field */
private Date lastTimestp;


/** persistent field */
private Long version;

/** persistent field */
private String deleteInd;

/** persistent field */
private String reqName;

/** full constructor */
public MtUuidLink(Long linkedUuid, Long activeUuid, String activeId,
String linkedId, String deptCd, String linkedTy,
String createBy, Date createDt, String updBy,
Date lastTimestp, String deleteInd) {
this.linkedUuid = linkedUuid;
this.activeUuid = activeUuid;
this.activeId = activeId;
this.linkedId = linkedId;
this.deptCd = deptCd;
this.linkedTy = linkedTy;
this.createBy = createBy;
this.createDt = createDt;
this.updBy = updBy;
this.lastTimestp = lastTimestp;
this.deleteInd = deleteInd;
}


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


/** minimal constructor */
public MtUuidLink(Long linkedUuid, Long activeUuid, String activeId,
String linkedId, String linkedTy, String createBy,
Date createDt, String updBy, Date lastTimestp) {
this.linkedUuid = linkedUuid;
this.activeUuid = activeUuid;
this.activeId = activeId;
this.linkedId = linkedId;
this.linkedTy = linkedTy;
this.createBy = createBy;
this.createDt = createDt;
this.updBy = updBy;
this.lastTimestp = lastTimestp;
}

public Long getLinkedUuid() {
return this.linkedUuid;
}

public void setLinkedUuid(Long linkedUuid) {
this.linkedUuid = linkedUuid;
}

public Long getActiveUuid() {
return this.activeUuid;
}

public void setActiveUuid(Long activeUuid) {
this.activeUuid = activeUuid;
}

public String getActiveId() {
return this.activeId;
}

public void setActiveId(String activeId) {
this.activeId = activeId;
}

public String getLinkedId() {
return this.linkedId;
}

public void setLinkedId(String linkedId) {
this.linkedId = linkedId;
}

public String getDeptCd() {
return this.deptCd;
}

public void setDeptCd(String deptCd) {
this.deptCd = deptCd;
}

public String getLinkedTy() {
return this.linkedTy;
}

public void setLinkedTy(String linkedTy) {
this.linkedTy = linkedTy;
}

public String getCreateBy() {
return this.createBy;
}

public void setCreateBy(String createBy) {
this.createBy = createBy;
}

public Date getCreateDt() {
return this.createDt;
}

public void setCreateDt(Date createDt) {
this.createDt = createDt;
}

public String getUpdBy() {
return this.updBy;
}

public void setUpdBy(String updBy) {
this.updBy = updBy;
}

public Date getLastTimestp() {
return this.lastTimestp;
}

public void setLastTimestp(Date lastTimestp) {
this.lastTimestp = lastTimestp;
}

public Long getVersion() {
return version;
}

public void setVersion(Long version) {
this.version = version;
}

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

public void setDeleteInd(String deleteInd)
{
this.deleteInd = deleteInd;
}

public String getDeleteInd()
{
return this.deleteInd;
}
}


Full stack trace of the Exception that occurs:
net.sf.hibernate.PropertyNotFoundException: Could not find a getter for deleteInd in class sg.gov.ciris.entity.MtUuidLink
at net.sf.hibernate.property.BasicPropertyAccessor.getGetter(BasicPropertyAccessor.java:182)
at net.sf.hibernate.mapping.Property.getGetter(Property.java:175)
at net.sf.hibernate.persister.AbstractEntityPersister.<init>(AbstractEntityPersister.java:749)
at net.sf.hibernate.persister.EntityPersister.<init>(EntityPersister.java:690)
at net.sf.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:42)
at net.sf.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:137)
at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:805)
at com.mp.dao.db.DbDaoFactory.init(DbDaoFactory.java:82)
at com.mp.dao.db.DbDaoFactory.<init>(DbDaoFactory.java:53)
at com.mp.dao.DaoFactory.getInstance(DaoFactory.java:49)
at sg.gov.ciris.idm.MtMgrBean.getRequestingDept(MtMgrBean.java:2747)
at sg.gov.ciris.idm.MtMgr_lpphm8_ELOImpl.getRequestingDept(MtMgr_lpphm8_ELOImpl.java:740)
at sg.gov.ciris.idm.delegate.MtDelegate.getRequestingDept(MtDelegate.java:1287)
at idm.unlinkFin.UnlinkFinController.getRequestingDeptList(UnlinkFinController.jpf:245)
at idm.unlinkFin.UnlinkFinController.begin(UnlinkFinController.jpf:124)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at com.bea.wlw.netui.pageflow.FlowController.invokeActionMethod(FlowController.java:1507)
at com.bea.wlw.netui.pageflow.FlowController.getActionMethodForward(FlowController.java:1433)
at com.bea.wlw.netui.pageflow.FlowController.internalExecute(FlowController.java:764)
at com.bea.wlw.netui.pageflow.PageFlowController.internalExecute(PageFlowController.java:211)
at com.bea.wlw.netui.pageflow.FlowController.execute(FlowController.java:594)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
at com.bea.wlw.netui.pageflow.PageFlowRequestProcessor.process(PageFlowRequestProcessor.java:650)
at com.bea.wlw.netui.pageflow.AutoRegisterActionServlet.process(AutoRegisterActionServlet.java:527)
at com.bea.wlw.netui.pageflow.PageFlowActionServlet.process(PageFlowActionServlet.java:152)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:1006)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:419)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:315)
at weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:328)
at com.bea.wlw.netui.pageflow.PageFlowRequestProcessor.superForward(PageFlowRequestProcessor.java:1301)
at com.bea.wlw.netui.pageflow.PageFlowRequestProcessor$DefaultHttpRedirector.forward(PageFlowRequestProcessor.java:1317)
at com.bea.wlw.netui.pageflow.PageFlowRequestProcessor.doForward(PageFlowRequestProcessor.java:1199)
at com.bea.wlw.netui.pageflow.PageFlowRequestProcessor.process(PageFlowRequestProcessor.java:637)
at com.bea.wlw.netui.pageflow.AutoRegisterActionServlet.process(AutoRegisterActionServlet.java:527)
at com.bea.wlw.netui.pageflow.PageFlowActionServlet.process(PageFlowActionServlet.java:152)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:1006)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:419)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:315)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:6722)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3764)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2644)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:219)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:178)

Name and version of the database being used:
Oracle 9
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9915
    
158

This might look silly, but have to ask - Are you sure that this is the class file that is being reffered by Hibernate? Make sure your classpath does NOT contain any other class file for this sg.gov.ciris.entity.MtUuidLink, which might NOT be having the getter method. The reason why i mention this is, looking at your code it looks like you had indeed missed out the getter/setter for the deleteInd and later on added this method in the class. If that's the case, then it might be that your classpath might be containing the older class file.


[My Blog] [JavaRanch Journal]
chundottu jacob
Greenhorn

Joined: Mar 13, 2006
Posts: 7
Hi,

You are right in thinking that the getter methods were recently added. The particular database table structure was modified recently to include 2 new fields, namely, 'deleteInd' and 'reqName'. So I added the get()/set() methods and the mapping entries for these 2 fields in the .hbm.xml file.

The correct .class file is included in the classpath. I verified the same by checking out the generated jars.

I also redeployed the application. But nothing seems to be working. I am still gettting the same error. Please help.

Thanks in advance.
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9915
    
158

The correct .class file is included in the classpath. I verified the same by checking out the generated jars.


In your classpath check whether there are any other jar files which contain this class file. My guess is that your classpath has some jar which contains the older version of your class file. Even though the new jar files that were generated contain the correct class file, these are not getting picked.
 
 
subject: PropertyNotFoundException in Hibernate
 
Similar Threads
One to many Relation
Hibernate Question
Hibernate Question
Could not read the data
Cannot find bean: "Element" in any scope