-->
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.  [ 4 posts ] 
Author Message
 Post subject: "QueryException: could not resolve property" error
PostPosted: Fri Jun 12, 2009 6:16 pm 
Newbie

Joined: Fri Jun 12, 2009 5:59 pm
Posts: 3
OK. I've scoured every bit of information I can find, and cannot find why I'm getting this error. I'm maintaining this project (not the original developer), so I've followed exactly what was in place on the existing project.

The error I'm getting is:
Code:
getMandatoryTrainingByMandatoryTrainingGroupId failed; nested exception is org.hibernate.QueryException: could not resolve property: mandatoryTrainingActive of: project.domain.employee.training.MandatoryTraining [select mandatoryTraining from project.domain.employee.training.MandatoryTraining mandatoryTraining


My hibernate mapping is as follows (non-relevant properties removed for space' sake):
Code:
<hibernate-mapping>
    <class name="project.domain.employee.training.MandatoryTraining" table="mandatorytraining" >
        <id name="id" type="int" column="mandatorytrainingid">
            <generator class="sequence">
                <param name="sequence">MandatoryTrainingID_seq</param>
            </generator>
        </id>
        <property name="mandatoryTrainingName" type="text">
            <column name="mandatorytrainingname" not-null="false"/>
        </property>
        <property name="mandatoryTrainingDesc" type="text">
            <column name="mandatorytrainingdesc" not-null="false"/>
        </property>
        <property name="mandatoryTrainingActive" type="project.persistence.support.BooleanToSmallInt">
             <column name="mandatorytrainingactive" not-null="true"/>
        </property>
    </class>
</hibernate-mapping>


The project.domain.employee.training.MandatoryTraining class inherits the project.base.domain.MandatoryTrainingBase abstract class, which contains the following definitions (Again, shortened):
Code:
public abstract class MandatoryTrainingBase extends project.domain.Domain {
    private Boolean mandatoryTrainingActive;
    public void setMandatoryTrainingActive(final Boolean isActive) {
       this.mandatoryTrainingActive = isActive;
    }
    public Boolean getMandatoryTrainingActive()
    {
       return this.mandatoryTrainingActive;
    }
}


The underlying database is PostgreSQL 8.1.9, with the field defined as:
mandatorytrainingactive, smallint, not null, default 1

I'm using Hibernate 3.2.4, Java 1.5.0_15.

What's baffling me is that I can properly access the property through normal java code, but the hibernate query is throwing this exception.

I'm not very familiar with hibernate, so I'm probably missing something terribly simple. Please help!

Thanks very much in advance.
-Doug


Top
 Profile  
 
 Post subject: Re: "QueryException: could not resolve property" error
PostPosted: Fri Jun 12, 2009 6:23 pm 
Beginner
Beginner

Joined: Mon Jun 01, 2009 5:39 am
Posts: 34
Code:
select -->mandatoryTraining<-- from project.domain.employee.training.MandatoryTraining mandatoryTraining


Shouldn't that be mandatoryTrainingActive instead?


Top
 Profile  
 
 Post subject: Re: "QueryException: could not resolve property" error
PostPosted: Fri Jun 12, 2009 6:33 pm 
Newbie

Joined: Fri Jun 12, 2009 5:59 pm
Posts: 3
No. I'm modifying an existing query to select where the mandatoryTrainingActive field is true. Everything else is exactly as it should be for this query.

Also, the error has nothing to do with the mandatoryTraining object, but the new mandatoryTrainingActive field which I've added, and for some reason Hibernate cannot see.


Top
 Profile  
 
 Post subject: Re: "QueryException: could not resolve property" error
PostPosted: Mon Jun 22, 2009 2:15 pm 
Newbie

Joined: Fri Jun 12, 2009 5:59 pm
Posts: 3
I ended up solving this problem last week.

The problem is that the original developers split the hibernate mappings out to a separate JAR file (and the mappings in the code base are ignored by the maven build script).

I ended up just extracting/editing/re-zipping the JAR file for now, and I'll fix the build script later.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.