-->
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.  [ 2 posts ] 
Author Message
 Post subject: <dynamic-component> in HQL Query
PostPosted: Thu Feb 16, 2006 10:02 am 
Beginner
Beginner

Joined: Thu Feb 16, 2006 9:53 am
Posts: 24
Hi all,

I'm using a dynamic-component and I would like to know how to write query on it.

Actually, my class is:

Code:
class A{
  string name;
  Map dynamicMap;
}



The keys contained by the map are defined at runtime.
Let's assume that we have a FOO_KEY, how can I write a query with a clause on this key.

Per example, what is the HQL for :
Code:
select * from A where FOO_COL='test'


I tried in vain:
Code:
"from A where dynamicMap.FOO_KEY = :value"


Thanks for your help.

Alexis

Hibernate version: 3.1.2


Top
 Profile  
 
 Post subject: mapping
PostPosted: Fri Feb 17, 2006 1:23 pm 
Expert
Expert

Joined: Fri Jul 22, 2005 2:42 pm
Posts: 670
Location: Seattle, WA
FOO_KEY should be declared in the mapping per
http://www.hibernate.org/hib_docs/v3/re ... ts-dynamic

For example the mapping:
<class lazy="false" name="ClassWithDynaComp" table="dyna_clomp_holder">
<id name="name">
<generator class="assigned"/>
</id>
<dynamic-component name="dynamicMap" >
<property name="aa" column="aa" type="string"/>
</dynamic-component>
</class>

Allows this query:
s.createQuery( "from ClassWithDynaComp where dynamicMap.aa LIKE '%'")

_________________
--------------
Konstantin

SourceLabs - dependable OpenSource systems


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