-->
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.  [ 7 posts ] 
Author Message
 Post subject: Problem with filter in joined-subclass map
PostPosted: Fri Oct 19, 2007 10:05 am 
Newbie

Joined: Mon Mar 06, 2006 7:25 am
Posts: 10
Hibernate version: 3.2.4ga

Mapping documents:
Code:
<hibernate-mapping default-access="field">
   <class name="org.escapek.core.domain.Node" table="NODES">
      <id name="Id" column="NODE_ID">
         <generator class="uuid"/>
      </id>
      <property name="instanceName" column="INSTANCE_NAME"/>
      <property name="creationDate" column="CREATION_DATE"/>
      <property name="lastModifiedDate" column="LAST_MODIFIED_DATE"/>
      <property name="deletedDate" column="DELETE_DATE"/>
      <property name="status" column="STATUS"/>
      <many-to-one name="owner" column="OWNER_FK" lazy="false" />
      <many-to-one name="creationUser" column="CREATION_USER_FK" lazy="false" />
      <many-to-one name="lastModifiedUser" column="LAST_MODIFIED_USER_FK" lazy="false" />
      <many-to-one name="deleteUser" column="DELETE_USER_FK" lazy="false" />
      <set name="notes" inverse="true">
         <key column="COMMENTED_NODE_FK"/>
         <one-to-many class="org.escapek.core.domain.Comment"/>
      </set>
      <joined-subclass name="org.escapek.core.objectmanager.domain.MOFLibrary" table="MOF_LIBRARY">
         <key column="NODE_ID"/>
         <property name="name" column="NAME"/>
         <property name="description" column="DESCRIPTION"/>
         <many-to-one name="parentLibrary" column="PARENT_LIBRARY_FK" lazy="false" />
         <map name="childrenLibs" inverse="true" lazy="true">
            <key column="PARENT_LIBRARY_FK"/>
            <map-key column="name" type="string"/>
            <one-to-many class="org.escapek.core.objectmanager.domain.MOFLibrary"/>
            <filter name="nodeStatus" condition=":nodeStatusParam = STATUS"/>
         </map>
         <map name="childrenFiles" inverse="true" lazy="true">
            <key column="LIBRARY_FK"/>
            <map-key column="name" type="string"/>
            <one-to-many class="org.escapek.core.objectmanager.domain.MOFFile"/>
            <filter name="nodeStatus" condition=":nodeStatusParam = STATUS"/>
         </map>
      </joined-subclass>
      <joined-subclass name="org.escapek.core.objectmanager.domain.MOFFile" table="MOF_FILE">
         <key column="NODE_ID"/>
         <property name="name" column="NAME"/>
         <property name="description" column="DESCRIPTION"/>
         <many-to-one name="library" column="LIBRARY_FK" lazy="false" />
         <property name="content" column="CONTENT" type="text" length="100000"/>
      </joined-subclass>
      <filter name="nodeStatus" condition=":nodeStatusParam = STATUS"/>
   </class>
   <filter-def name="nodeStatus">
       <filter-param name="nodeStatusParam" type="string"/>
   </filter-def>
</hibernate-mapping>


With this mapping, I've got problems when reading one of the maps declared in MOFLibrary. Error comes from DBMS which says that column STATUS does not exists.
What I guess is that when reading the collection, MOF_LIBRARY or MOF_FILE tables are not joined with tables NODES, the table from the parent class where the STATUS column is declared. Is there a may to make this work ? I've seen quite several problems on the forum and JIRA, but I'm not sure there were the same.

Another question : Why is the filter not applied by default when reading the collection ? I have to put it in the <map> else every records are returned.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 19, 2007 10:29 am 
Newbie

Joined: Mon Mar 06, 2006 7:25 am
Posts: 10
Here is the last SQL which generates the error:

Code:
select
   childrenfi0_.LIBRARY_FK as LIBRARY4_1_,
   childrenfi0_.NODE_ID as NODE1_1_,
   childrenfi0_.name as name1_,
   childrenfi0_.NODE_ID as NODE1_0_0_,
   childrenfi0_1_.INSTANCE_NAME as INSTANCE2_0_0_,
   childrenfi0_1_.CREATION_DATE as CREATION3_0_0_,
   childrenfi0_1_.LAST_MODIFIED_DATE as LAST4_0_0_,
   childrenfi0_1_.DELETE_DATE as DELETE5_0_0_,
   childrenfi0_1_.STATUS as STATUS0_0_,
   childrenfi0_1_.OWNER_FK as OWNER7_0_0_,
   childrenfi0_1_.CREATION_USER_FK as CREATION8_0_0_,
   childrenfi0_1_.LAST_MODIFIED_USER_FK as LAST9_0_0_,
   childrenfi0_1_.DELETE_USER_FK as DELETE10_0_0_,
   childrenfi0_.NAME as NAME17_0_,
   childrenfi0_.DESCRIPTION as DESCRIPT3_17_0_,
   childrenfi0_.LIBRARY_FK as LIBRARY4_17_0_,
   childrenfi0_.CONTENT as CONTENT17_0_
from
   MOF_FILE childrenfi0_, NODES childrenfi0_1_
where
   childrenfi0_.NODE_ID=childrenfi0_1_.NODE_ID
and 
   :nodeStatus.nodeStatusParam = STATUS
   and childrenfi0_.LIBRARY_FK=?


This shows that subclass table is joined with master class but the STATUS column is not prefixed with NODES alias childrenfi0_1_.
I've tried to change the filter declaration in the mapping to prefix the column name with the table name:

Code:
<filter name="nodeStatus" condition=":nodeStatusParam = NODES.STATUS"/>

but it gets the same error.[/code]


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 19, 2007 10:33 am 
Newbie

Joined: Mon Mar 06, 2006 7:25 am
Posts: 10
Here is the last SQL which generates the error:

Code:
select
   childrenfi0_.LIBRARY_FK as LIBRARY4_1_,
   childrenfi0_.NODE_ID as NODE1_1_,
   childrenfi0_.name as name1_,
   childrenfi0_.NODE_ID as NODE1_0_0_,
   childrenfi0_1_.INSTANCE_NAME as INSTANCE2_0_0_,
   childrenfi0_1_.CREATION_DATE as CREATION3_0_0_,
   childrenfi0_1_.LAST_MODIFIED_DATE as LAST4_0_0_,
   childrenfi0_1_.DELETE_DATE as DELETE5_0_0_,
   childrenfi0_1_.STATUS as STATUS0_0_,
   childrenfi0_1_.OWNER_FK as OWNER7_0_0_,
   childrenfi0_1_.CREATION_USER_FK as CREATION8_0_0_,
   childrenfi0_1_.LAST_MODIFIED_USER_FK as LAST9_0_0_,
   childrenfi0_1_.DELETE_USER_FK as DELETE10_0_0_,
   childrenfi0_.NAME as NAME17_0_,
   childrenfi0_.DESCRIPTION as DESCRIPT3_17_0_,
   childrenfi0_.LIBRARY_FK as LIBRARY4_17_0_,
   childrenfi0_.CONTENT as CONTENT17_0_
from
   MOF_FILE childrenfi0_, NODES childrenfi0_1_
where
   childrenfi0_.NODE_ID=childrenfi0_1_.NODE_ID
and 
   :nodeStatus.nodeStatusParam = STATUS
   and childrenfi0_.LIBRARY_FK=?


This shows that subclass table is joined with master class but the STATUS column is not prefixed with NODES alias childrenfi0_1_.
I've tried to change the filter declaration in the mapping to prefix the column name with the table name:

Code:
<filter name="nodeStatus" condition=":nodeStatusParam = NODES.STATUS"/>

but it gets the same error.[/code]


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 19, 2007 10:35 am 
Newbie

Joined: Mon Mar 06, 2006 7:25 am
Posts: 10
Here is the last SQL which generates the error:

Code:
select
   childrenfi0_.LIBRARY_FK as LIBRARY4_1_,
   childrenfi0_.NODE_ID as NODE1_1_,
   childrenfi0_.name as name1_,
   childrenfi0_.NODE_ID as NODE1_0_0_,
   childrenfi0_1_.INSTANCE_NAME as INSTANCE2_0_0_,
   childrenfi0_1_.CREATION_DATE as CREATION3_0_0_,
   childrenfi0_1_.LAST_MODIFIED_DATE as LAST4_0_0_,
   childrenfi0_1_.DELETE_DATE as DELETE5_0_0_,
   childrenfi0_1_.STATUS as STATUS0_0_,
   childrenfi0_1_.OWNER_FK as OWNER7_0_0_,
   childrenfi0_1_.CREATION_USER_FK as CREATION8_0_0_,
   childrenfi0_1_.LAST_MODIFIED_USER_FK as LAST9_0_0_,
   childrenfi0_1_.DELETE_USER_FK as DELETE10_0_0_,
   childrenfi0_.NAME as NAME17_0_,
   childrenfi0_.DESCRIPTION as DESCRIPT3_17_0_,
   childrenfi0_.LIBRARY_FK as LIBRARY4_17_0_,
   childrenfi0_.CONTENT as CONTENT17_0_
from
   MOF_FILE childrenfi0_, NODES childrenfi0_1_
where
   childrenfi0_.NODE_ID=childrenfi0_1_.NODE_ID
and 
   :nodeStatus.nodeStatusParam = STATUS
   and childrenfi0_.LIBRARY_FK=?


This shows that subclass table is joined with master class but the STATUS column is not prefixed with NODES alias childrenfi0_1_.
I've tried to change the filter declaration in the mapping to prefix the column name with the table name:

Code:
<filter name="nodeStatus" condition=":nodeStatusParam = NODES.STATUS"/>

but it gets the same error.[/code]


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 19, 2007 10:37 am 
Newbie

Joined: Mon Mar 06, 2006 7:25 am
Posts: 10
Here is the last SQL which generates the error:

Code:
select
   childrenfi0_.LIBRARY_FK as LIBRARY4_1_,
   childrenfi0_.NODE_ID as NODE1_1_,
   childrenfi0_.name as name1_,
   childrenfi0_.NODE_ID as NODE1_0_0_,
   childrenfi0_1_.INSTANCE_NAME as INSTANCE2_0_0_,
   childrenfi0_1_.CREATION_DATE as CREATION3_0_0_,
   childrenfi0_1_.LAST_MODIFIED_DATE as LAST4_0_0_,
   childrenfi0_1_.DELETE_DATE as DELETE5_0_0_,
   childrenfi0_1_.STATUS as STATUS0_0_,
   childrenfi0_1_.OWNER_FK as OWNER7_0_0_,
   childrenfi0_1_.CREATION_USER_FK as CREATION8_0_0_,
   childrenfi0_1_.LAST_MODIFIED_USER_FK as LAST9_0_0_,
   childrenfi0_1_.DELETE_USER_FK as DELETE10_0_0_,
   childrenfi0_.NAME as NAME17_0_,
   childrenfi0_.DESCRIPTION as DESCRIPT3_17_0_,
   childrenfi0_.LIBRARY_FK as LIBRARY4_17_0_,
   childrenfi0_.CONTENT as CONTENT17_0_
from
   MOF_FILE childrenfi0_, NODES childrenfi0_1_
where
   childrenfi0_.NODE_ID=childrenfi0_1_.NODE_ID
and 
   :nodeStatus.nodeStatusParam = STATUS
   and childrenfi0_.LIBRARY_FK=?


This shows that subclass table is joined with master class but the STATUS column is not prefixed with NODES alias childrenfi0_1_.
I've tried to change the filter declaration in the mapping to prefix the column name with the table name:

Code:
<filter name="nodeStatus" condition=":nodeStatusParam = NODES.STATUS"/>

but it gets the same error.[/code]


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 19, 2007 10:45 am 
Newbie

Joined: Mon Mar 06, 2006 7:25 am
Posts: 10
Sorry for duplicates messages. I had error when submitting reply, so I retried, but messages were inserted. :(


Top
 Profile  
 
 Post subject:
PostPosted: Sat Oct 20, 2007 3:13 pm 
Newbie

Joined: Mon Mar 06, 2006 7:25 am
Posts: 10
I guess this problem is related to HHH-1901.


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