|
Re: With Teneo and EAV schema, what is the best approach to do non-id based query? [message #511808 is a reply to message #511775] |
Wed, 03 February 2010 00:49 |
Martin Taal Messages: 5468 Registered: July 2009 |
Senior Member |
|
|
Hi tr,
Afaics there is no faster/better approach than this. The much more complex querying is one of the major disadvantages of
EAV mapping.
gr. Martin
tr wrote:
> Hi,
> I am using Teneo under EAV schema, but got really confused on what the
> best approach is to do non-id based query. Thanks for help in advance!
>
> I have the following type defined in XSD:
>
> <xsd:complexType name="PersonType">
> <xsd:sequence>
> <xsd:element name="FirstName" type="xsd:string"/>
> <xsd:element name="LastName" type="xsd:string"/>
> <xsd:element name="Age" type="xsd:integer"/>
> </xsd:sequence>
> </xsd:complexType>
>
> Then some persontype records were inserted into the EAV tables.
> So the question is if I want to execute a query of "select * from
> PersonType where FirstName='aaa' and Lastname='bbb' and Age>23"
>
> Should I create a query like below, or if there is a better and faster
> (in term of query performance) approach to do it?
> qry = session.createQuery("select eav1.owner from
> EAVSingleEAttributeValueHolder eav1, EAVSingleEAttributeValueHolder
> eav2, EAVSingleEAttributeValueHolder eav3 where " +
> " eav1.feature='http://com.test/TestCase_;_PersonType_;_FirstName'
> and eav1.stringValue='aaa' and " +
> " eav2.feature='http://com.test/TestCase_;_PersonType_;_LastName'
> and eav2.stringValue='bbb' and " +
> " eav3.feature='http://com.test/TestCase_;_PersonType_;_Age' and
> eav3.longValue>23 and " +
> " eav1.owner=eav2.owner and eav2.owner=eav3.owner" );
>
>
>
>
>
> Thanks for help!
>
--
With Regards, Martin Taal
Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
|
|
|
|
Powered by
FUDForum. Page generated in 0.02803 seconds