0

I need to find an entry in the JCR where a Date in a list of nodes containing dates matches my criteria. Data Structure is

- Event1 -- Dates --- 0 ---- startDate: xyz ---- endDate: xyz --- 1 ---- startDate: xyz ---- endDate: xyz - Event1 -- Dates --- 0 ---- startDate: xyz ---- endDate: xyz --- 1 ---- startDate: xyz ---- endDate: xyz

Data Structure

So I need iterate over all Nodes and now I need to select the subnode called DATE and iterate over that and check the timestamp prop. If the timestamp matches my criterium, then return the whole node.

here's a failed attempt:

select p.date from [mgnl:contact] as p where p.[startDate] > CAST('2010-01-01T00:00:00.000+02:00' as date)

which i was hoping to fetch me all entries after jan 1. 2010.

I could do this by just grabbing everything from the jcr and doing this filtering in Java. In JCR-SQL2, I don't even know where to start.

Jonas
  • 381
  • 3
  • 15

1 Answers1

2

I guess it doesn't work because p.date is not direct property of the given node type. I assume it'd work if you change it to mgnl:contentNode.

Also give this a shot:

select * from [mgnl:contact] where [startDate] > cast('2010-01-01T00:00:00.000+02:00' as date)

Cheers,

HTH,

Ducaz035
  • 3,054
  • 2
  • 25
  • 45
  • thank you! both answers sadly give back empty results. I guess the problem is, that [startDate] is a child of an unnamed (numbered) node which is in turn a child of a node called [date]. I don't understand how I can query the child props of a list of such unnamed nodes. The way you wrote your queries, it seems I can just ignore the path of the nodes? thanks again! – Jonas Jun 15 '18 at 08:24
  • seems I misunderstood before. playing around with it it's solved and you were absolutely right in your comment. thank you! – Jonas Jun 15 '18 at 09:25