[ 
https://issues.apache.org/jira/browse/OPENJPA-1465?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Milosz Tylenda updated OPENJPA-1465:
------------------------------------

    Description: 
A request for query support over multi-valued elements within XML column has 
been posted on the user mailing list [1]. We currently support only queries 
over single-valued elements.

I have investigated the matter a bit using MySQL. It seems that a query working 
correctly over multi-valued elements can be constructed like this ("street" is 
multi-valued):

select * from TORDER t0 where 
ExtractValue(t0.shipAddress,'count(/*/street[text()="Lelevela"]) >= 1') = 1;
or
select * from TORDER t0 where 
ExtractValue(t0.shipAddress,'count(/*/street[text()="Lelevela"])') >= 1;

What worries me is that such a query might not be indexable even if the 
database supports indexes over expressions.

[1] 
http://openjpa.208410.n2.nabble.com/quot-collection-valued-path-quot-ArgumentException-when-querying-based-on-multi-valued-elements-in-an-td4162113.html
[2] 
http://openjpa.208410.n2.nabble.com/JPA-XmlValueHandler-doesn-t-work-with-Multi-Valued-fileds-td7582589.html


  was:
A request for query support over multi-valued elements within XML column has 
been posted on the user mailing list [1]. We currently support only queries 
over single-valued elements.

I have investigated the matter a bit using MySQL. It seems that a query working 
correctly over multi-valued elements can be constructed like this ("street" is 
multi-valued):

select * from TORDER t0 where 
ExtractValue(t0.shipAddress,'count(/*/street[text()="Lelevela"]) >= 1') = 1;
or
select * from TORDER t0 where 
ExtractValue(t0.shipAddress,'count(/*/street[text()="Lelevela"])') >= 1;

What worries me is that such a query might not be indexable even if the 
database supports indexes over expressions.

[1] 
http://n2.nabble.com/collection-valued-path-ArgumentException-when-querying-based-on-multi-valued-elements-in-an-XML-colun-tp4162113p4162113.html


    
> Queries over multi-valued elements within XML column
> ----------------------------------------------------
>
>                 Key: OPENJPA-1465
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1465
>             Project: OpenJPA
>          Issue Type: Improvement
>          Components: query, sql
>    Affects Versions: 1.2.1
>            Reporter: Milosz Tylenda
>
> A request for query support over multi-valued elements within XML column has 
> been posted on the user mailing list [1]. We currently support only queries 
> over single-valued elements.
> I have investigated the matter a bit using MySQL. It seems that a query 
> working correctly over multi-valued elements can be constructed like this 
> ("street" is multi-valued):
> select * from TORDER t0 where 
> ExtractValue(t0.shipAddress,'count(/*/street[text()="Lelevela"]) >= 1') = 1;
> or
> select * from TORDER t0 where 
> ExtractValue(t0.shipAddress,'count(/*/street[text()="Lelevela"])') >= 1;
> What worries me is that such a query might not be indexable even if the 
> database supports indexes over expressions.
> [1] 
> http://openjpa.208410.n2.nabble.com/quot-collection-valued-path-quot-ArgumentException-when-querying-based-on-multi-valued-elements-in-an-td4162113.html
> [2] 
> http://openjpa.208410.n2.nabble.com/JPA-XmlValueHandler-doesn-t-work-with-Multi-Valued-fileds-td7582589.html

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to