-->
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: Mapping Map
PostPosted: Mon Aug 18, 2008 9:17 am 
Newbie

Joined: Mon Aug 18, 2008 6:47 am
Posts: 1
Hi,
I have a problem to do the mapping of my map.

I have an entity Node.

Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
   "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
   "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="it.quix.extensibility.model">
   <class name="Node" table="cat_node">
      <id name="id" column="id" type="long" unsaved-value="0">
         <generator class="increment"></generator>
      </id>
      <many-to-one name="parent" class="Node">
         <column name="parentid" not-null="false" />
        </many-to-one>
      <property name="code" type="string" column="code" not-null="false" length="50"/>
      <property name="name" type="string" column="name" not-null="false" length="100"/>
      <property name="type" type="string" column="type" not-null="false" length="100"/>
      <map name="properties" cascade="all-delete-orphan">
            <key column="nodeid" not-null="true" foreign-key="FK1cat_nodeproperties_cat_node" />
            <map-key column="name" type="string" length="100" />
         <one-to-many class="PropertyValue" />
      </map>
   </class>
</hibernate-mapping>


Node contains a map properties where key is a string and value is an entity PropertyValue.

Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
   "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
   "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="it.quix.extensibility.model">
   <class name="PropertyValue" table="cat_nodeproperties" lazy="false">
      <id name="id" column="id" type="long" unsaved-value="0">
         <generator class="increment"></generator>
      </id>
      <property name="type" column="type" type="string" length="15" not-null="true" />
      <property name="booleanValue" column="booleanvalue" type="boolean" />
      <property name="longValue" column="longvalue" type="long" />
      <property name="decimalValue" column="decimalvalue" type="big_decimal" />
      <property name="stringValue" column="stringvalue" type="string" length="1024"/>
      <property name="dateValue" column="datevalue" type="timestamp" />
      <list name="attributeList" table="cat_attribute" cascade="delete">
         <key column="nodepropertiesid" not-null="true" />
         <list-index column="sorting" base="1" />
         <composite-element class="Attribute">
            <property name="type" column="type" type="string" length="15" not-null="true" />
               <property name="booleanValue" column="booleanvalue" type="boolean" />
              <property name="longValue" column="longvalue" type="long" />
              <property name="decimalValue" column="decimalvalue" type="big_decimal" />
              <property name="stringValue" column="stringvalue" type="string" length="1024"/>
              <property name="dateValue" column="datevalue" type="timestamp" />
         </composite-element>
      </list>
   </class>
</hibernate-mapping>


I want to get all the nodes that contain the property with key ik06 and stringValue D33.

I have executed this HQL query:

Code:
from Node as n
join n.properties as prop
where index(prop) = 'ik06' and
??? prop.stringValue = 'D33' ???


but prop.stringValue is not correct.
What is the correct sintax?

Thanks,
Emanuela


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.