-->
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: Using elements() function - re: expecting 'elements' error
PostPosted: Wed Mar 26, 2008 2:05 pm 
Regular
Regular

Joined: Thu Nov 30, 2006 10:48 am
Posts: 59
I have the following classes and relationships:

- PhysicalNetworkDevice inherits from ManagedElement
- ManagedElement bidirectional 1-M PropertyValue (C# properties: PropertyValues in ManagedElement class; PManagedElement in PropertyValue class)
- PropertyValue unidirectional M-1 PropertyTemplate (C# property: PPropertyTemplate in PropertyValue)

I just want to create an HQL query as follows: select pnd from PhysicalNetworkDevice pnd where pnd.PropertyValues.PPropertyTemplate.Name = 'CPUUtil';

But I get the error: expecting 'elements' or 'indices' after PPropertyTemplate

I tried the following and they don't work:

select pnd from PhysicalNetworkDevice pnd where all elements(pnd.PropertyValues.PPropertyTemplate.Name) = 'CPUUtil';

select pnd from PhysicalNetworkDevice pnd where all elements(pnd.PropertyValues.PPropertyTemplate).Name = 'CPUUtil';

I then did a theta-styl join (as follows) and it worked BUT ... the query took over 15 seconds to execute with only a few thousand rows in the SQL Server db tables (with the nHibernate log file growing by 70mb each time the query executed -- log4net level was set to DEBUG):

select pnd from PhysicalNetworkDevice pnd, PropertyValue pv, PropertyTemplate pt
where (pv.PManagedElement = pnd.ID) and (pv.PPropertyTemplate.ID = pt.ID)
and (pt.Name = 'CPUUtil')

nHibernate Class Mappings:

<class name="ManagedElement, Domain" table="dbo.tblManagedElement">
<bag name="PropertyValues" cascade="all-delete-orphan" outer-join="true" inverse="true">
<key column="FK_ManagedElementID"/>
<one-to-many class="PropertyValue, Domain"/>
</bag>
<joined-subclass name="PhysicalNetworkDevice, Domain" table="tblDevice">
...
</joined-subclass>
<class>

<class name="PropertyTemplate, Domain" table="dbo.tblPropertyTemplate">
<property name="Name" column="PropertyTemplateName"/>
</class>

<class name="PropertyValue, Domain" table="dbo.tblPropertyValue">
<many-to-one
name="PManagedElement"
column="FK_ManagedElementID"
class="ManagedElement, Domain"
not-null="true"
/>

<!-- Unidirectional -->
<many-to-one
name="PPropertyTemplate"
column="FK_PropertyTemplateID"
class="PropertyTemplate, Domain"
not-null="true"
outer-join="true"
/>
</class>

Thanks,
Bill

_________________
metazone


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 28, 2008 4:54 am 
Expert
Expert

Joined: Thu Dec 14, 2006 5:57 am
Posts: 1185
Location: Zurich, Switzerland
Can't see an obvious error in your initial query. Can you post the generated sql and the query code ?

_________________
--Wolfgang


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.