Hibernate Books

All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Could not resolve property type in Query
PostPosted: Mon Sep 01, 2003 1:25 pm 
Newbie

Joined: Mon Sep 01, 2003 1:22 pm
Posts: 16
Location: France
Hi,

I'm trying to execute the following query with hibernate :

from org.smartcomps.twister.engine.priv.core.dynamic.impl.ProcessInstanceImpl as instance
join fetch instance.properties as props
where
props.name in (:propNames) and
props.value in (:propValues)

I'm getting this exception :

net.sf.hibernate.QueryException: could not resolve property type: name [from org.smartcomps.twister.engine.priv.core.dynamic.impl.ProcessInstanceImpl as instance join fetch instance.properties as props where props.name in (:propNames0_, :propNames1_) and props.value in (:propValues0_, :propValues1_)]

Here is the mappings of the two classes involved :

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd";>

<hibernate-mapping>
<class name="org.smartcomps.twister.engine.priv.core.dynamic.impl.ProcessInstanceImpl" table="PROCESS_INSTANCE">
<id name="id" column="ID" type="long">
<generator class="hilo">
<param name="table">PROCESS_ID</param>
<param name="column">NEXT</param>
</generator>
</id>

<property name="status" type="int" not-null="true"/>

<!-- <set name="events" inverse="true">-->
<!-- <key column="SRC_INST_ID"/>-->
<!-- <one-to-many class="org.smartcomps.twister.engine.priv.core.dynamic.impl.ExecutionEventImpl"/>-->
<!-- </set>-->

<many-to-one name="process"
class="org.smartcomps.twister.engine.priv.core.definition.impl.ProcessImpl" column="SRC_PROC_ID"/>

<many-to-one name="childExecutionContext"
class="org.smartcomps.twister.engine.priv.core.dynamic.impl.ExecutionContextImpl" column="EC_ID"/>

<set name="properties" inverse="true">
<key column="PROC_INST_ID"/>
<one-to-many class="org.smartcomps.twister.engine.priv.core.dynamic.impl.ProcessInstanceImpl"/>
</set>

</class>
</hibernate-mapping>

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd";>

<hibernate-mapping>
<class name="org.smartcomps.twister.engine.priv.core.dynamic.impl.ValuedPropertyImpl" table="VALUED_PROP">
<id name="id" column="id" type="long">
<generator class="hilo">
<param name="table">VALUED_PROP_ID</param>
<param name="column">NEXT</param>
</generator>
</id>
<property name="name" type="string" not-null="true"/>
<property name="value" type="string" not-null="true"/>
</class>
</hibernate-mapping>

It seems that hibernates tries to find a "name" property in the class ProcessInstance instead of the class ValuedProperty for the where clause "props.name in (:propNames)". I tried several things but couldn't figure out why it was doing so. Could somebody help ?

Thanks a lot and have a nice day.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 01, 2003 1:38 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1812
Location: Austin, TX
Code:
<set name="properties" inverse="true">
<key column="PROC_INST_ID"/>
<one-to-many class="org.smartcomps.twister.engine.priv.core.dynamic.impl.ProcessInstanceImpl"/>
</set>


You are telling hibernate that the type of the properties property on the ProcessInstanceImpl class is also of type ProcessInstanceImpl. I think what you are trying to do is:
Code:
<set name="properties" inverse="true">
<key column="PROC_INST_ID"/>
<one-to-many class="org.smartcomps.twister.engine.priv.core.dynamic.impl.ValuedPropertyImpl"/>
</set>


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 01, 2003 1:48 pm 
Newbie

Joined: Mon Sep 01, 2003 1:22 pm
Posts: 16
Location: France
Ooops, sorry about that, copy/paste saves a lot of a time but generates tons of stupid mistakes. Thanks a lot for your time.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 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.