-->
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.  [ 1 post ] 
Author Message
 Post subject: could not resolve property, argh!
PostPosted: Mon Dec 14, 2009 2:08 pm 
Newbie

Joined: Mon Dec 14, 2009 1:45 pm
Posts: 1
Hi,

I'm getting the next Exception and I can not figure why: org.hibernate.QueryException: could not resolve property. Any help will be appreciated!!!

My entity Phone is:

Code:
@Entity
public class Phone extends Device {

    private Long controller_device_id;
    private Long controller_output_id;
    private Long pbx_line;
    private String phone_number;
    private int test_int;

...
    public String getPhone_Number(){
        return this.phone_number;
    }
    public void setPhone_Number(String phone_number){
        this.phone_number=phone_number;
    }
    public void setController_Device_Id(Long controller_device_id) {
        this.controller_device_id = controller_device_id;
    }

    public Long getController_Device_Id() {
        return this.controller_device_id;
    }

    public void setController_Output_Id(Long controller_output_id) {
        this.controller_output_id = controller_output_id;
    }

    public Long getController_Output_Id() {
        return this.controller_output_id;
    }

    public void setPbx_Line(Long pbx_line){
        this.pbx_line=pbx_line;
    }
    public Long getPbx_Line(){
        return this.pbx_line;
    }
    public void setTest_Int(int test_int){
        this.test_int=test_int;
    }
    public int getTest_Int(){
        return this.test_int;
    }
}


and Device is:

Code:
@Entity(name="Device")
@Inheritance(strategy=InheritanceType.JOINED)
abstract public class Device implements Serializable{
    private Long id;
    private String name;
    private String notes;
    private Date statuschecklasttime;
    private long statuscheckinterval;

...

@Id
    @GeneratedValue(strategy=GenerationType.TABLE)
    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }

    public String getNotes(){
        return notes;
    }
    public void setNotes(String notes){
        this.notes=notes;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name=name;
    }
public void setStatusCheckLastTime (Date statuschecklasttime){
        this.statuschecklasttime=statuschecklasttime;
    }
    @Temporal(TemporalType.TIMESTAMP)
    public Date getStatusCheckLastTime () {
        return this.statuschecklasttime;
    }
    public void setStatusCheckInterval(long statuscheckinterval){
        this.statuscheckinterval=statuscheckinterval;
    }
    public long getStatusCheckInterval(){
        return this.statuscheckinterval;
    }



The properties of the table (PostgreSQL) are:

Code:
                 Table "public.phone"
        Column        |          Type          | Modifiers
----------------------+------------------------+-----------
controller_device_id | bigint                 | not null
controller_output_id | bigint                 | not null
id                   | bigint                 | not null
pbx_line             | bigint                 |
phone_number         | character varying(255) |
test_int             | integer                |
Indexes:
    "phone_pkey" PRIMARY KEY, btree (id)
Foreign-key constraints:
    "dev_id_fk" FOREIGN KEY (controller_device_id) REFERENCES device(id)
    "device_id_fk" FOREIGN KEY (id) REFERENCES device(id)


controller_device_id references the id of another subclass of device.

Query which makes Exception being thrown:

Code:
                               Phone otherphone = (Phone) em.createQuery("SELECT p FROM Phone p " +
                                        "WHERE p.test_int = :integ AND " +
                                        "p.controller_output_id = :output AND " +
                                        "p.controller_device_id = :pbx ").
                                        setParameter("integ", 4).
                                        setParameter("output", new Long(phone_position)).
                                        setParameter("pbx", pbx.getId()).getSingleResult();


I get the same exception (cannot resolve controller_output_id or controller_device_id) if in the query they appear before.

Exception stack:

Quote:
java.lang.IllegalArgumentException: org.hibernate.QueryException: could not resolve property: test_int of: blablabla.Phone [SELECT p FROM blablabla.Phone p WHERE p.test_int = :integ AND p.controller_output_id = :output AND p.controller_device_id = :pbx ]
at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:624)
at org.hibernate.ejb.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:96)
at com.sun.enterprise.container.common.impl.EntityManagerWrapper.createQuery(EntityManagerWrapper.java:367)
at blablabla.getMessagesFromPbx(blablabla.java:1360)
at blablabla.setconnection(blablabla.java:675)
at blablabla.DeviceManager.loadDevices(DeviceManager.java:217)
at blablabla.DeviceManager.service(DeviceManager.java:72)
at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:431)
at org.apache.catalina.core.StandardWrapperValve.preInvoke(StandardWrapperValve.java:462)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:139)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:186)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:719)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:657)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:96)
at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:98)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:187)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:719)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:657)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:651)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1030)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:142)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:719)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:657)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:651)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1030)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:325)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:242)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:180)
at com.sun.grizzly.http.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:633)
at com.sun.grizzly.http.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:570)
at com.sun.grizzly.http.DefaultProcessorTask.process(DefaultProcessorTask.java:827)
at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:152)
at com.sun.enterprise.v3.services.impl.GlassfishProtocolChain.executeProtocolFilter(GlassfishProtocolChain.java:71)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:103)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:89)
at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)
at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:67)
at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:56)
at com.sun.grizzly.util.WorkerThreadImpl.processTask(WorkerThreadImpl.java:325)
at com.sun.grizzly.util.WorkerThreadImpl.run(WorkerThreadImpl.java:184)
Caused by: org.hibernate.QueryException: could not resolve property: test_int of: blablabla.Phone [SELECT p FROM blablabla.Phone p WHERE p.test_int = :integ AND p.controller_output_id = :output AND p.controller_device_id = :pbx ]
at org.hibernate.persister.entity.AbstractPropertyMapping.propertyException(AbstractPropertyMapping.java:44)
at org.hibernate.persister.entity.AbstractPropertyMapping.toType(AbstractPropertyMapping.java:38)
at org.hibernate.persister.entity.AbstractEntityPersister.toType(AbstractEntityPersister.java:1358)
at org.hibernate.hql.ast.tree.FromElementType.getPropertyType(FromElementType.java:279)
at org.hibernate.hql.ast.tree.FromElement.getPropertyType(FromElement.java:386)
at org.hibernate.hql.ast.tree.DotNode.getDataType(DotNode.java:566)
at org.hibernate.hql.ast.tree.DotNode.prepareLhs(DotNode.java:241)
at org.hibernate.hql.ast.tree.DotNode.resolve(DotNode.java:188)
at org.hibernate.hql.ast.tree.FromReferenceNode.resolve(FromReferenceNode.java:94)
at org.hibernate.hql.ast.tree.FromReferenceNode.resolve(FromReferenceNode.java:90)
at org.hibernate.hql.ast.HqlSqlWalker.resolve(HqlSqlWalker.java:728)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.expr(HqlSqlBaseWalker.java:1216)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.exprOrSubquery(HqlSqlBaseWalker.java:4041)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.comparisonExpr(HqlSqlBaseWalker.java:3525)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1762)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1687)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1687)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.whereClause(HqlSqlBaseWalker.java:776)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:577)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:281)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:229)
at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:228)
at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:160)
at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:111)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:77)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:56)
at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:72)
at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:133)
at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:112)
at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1623)
at org.hibernate.ejb.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:93)
... 38 more


Tell me why do you think this exeption appears, please. I'm sure there is something I'm doing wrong.

Thanks!


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

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.