Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » With Teneo and EAV schema, what is the best approach to do non-id based query?
With Teneo and EAV schema, what is the best approach to do non-id based query? [message #511775] Tue, 02 February 2010 19:00 Go to next message
tr  is currently offline tr Friend
Messages: 5
Registered: November 2009
Junior Member
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!
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 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
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
Re: With Teneo and EAV schema, what is the best approach to do non-id based query? [message #511992 is a reply to message #511808] Wed, 03 February 2010 15:29 Go to previous message
tr  is currently offline tr Friend
Messages: 5
Registered: November 2009
Junior Member
Thanks for addressing the question!
Previous Topic:[CDO] DBTable exists when committing
Next Topic:Determine subclasses from a metaclass
Goto Forum:
  


Current Time: Thu Apr 25 12:52:46 GMT 2024

Powered by FUDForum. Page generated in 0.02803 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top