Hi David,
David B. Johnson wrote:
I am running a repository on the 1.2 Release Candidate that I upgraded
from 1.1.1, i.e., I did not reload the data, I am using the same
repository. It is a JNDI DataSource Repository with a MySQL backend,
running as a JCA rar in JBoss. I am using an SQL query that was working
fine in 1.1.1 and now appears to not work in 1.2, specifically the query
is of the form:
select * from Story where jcr:path like '/News/Stories/%' and
publishDate >= DATE '2006-11-01' and publishDate <= DATE '2006-11-15'
Instead of only returning stories with a publishDate within the date
range, the system appears to return all stories.
Do I need to create a fresh repository, and re-import the data?
no, that shouldn't be necessary. all changes in 1.2 are backward compatible. at
least that's the goal.
I quickly tried to reproduce the issue with a simple test case [1]. First I ran
the test on a jackrabbit 1.1 and then again on a jackrabbit 1.2 pointing to the
existing 1.1 repository data. Both returned the same 30 results.
If I can help with any additional information, please feel free to
contact me.
Is there anything else you changed when you upgraded jackrabbit?
Can you please check if you can reproduce the issue with the below test case in
your environment?
regards
marcel
[1] test class:
package org.apache.jackrabbit.core.query;
import javax.jcr.RepositoryException;
import javax.jcr.Node;
import javax.jcr.query.QueryManager;
import javax.jcr.query.Query;
import java.util.Calendar;
import java.text.SimpleDateFormat;
/**
* <code>DateRangeTest</code>...
*/
public class DateRangeTest extends AbstractQueryTest {
private static final SimpleDateFormat FORMAT = new
SimpleDateFormat("yyyy-MM-dd");
public void testRange() throws RepositoryException {
if (!superuser.itemExists("/data")) {
System.out.println("creating test data...");
Node data = superuser.getRootNode().addNode("data");
for (int i = 0; i < 100; i++) {
Calendar c = Calendar.getInstance();
c.add(Calendar.DATE, i);
data.addNode("node" + i).setProperty("date", c);
}
superuser.save();
}
QueryManager qm = superuser.getWorkspace().getQueryManager();
Calendar lower = Calendar.getInstance();
lower.add(Calendar.DATE, 20);
Calendar upper = Calendar.getInstance();
upper.add(Calendar.DATE, 50);
String sql = "select * from nt:unstructured " +
"where " +
"jcr:path like '/data/%' and " +
"date >= DATE '" + FORMAT.format(lower.getTime()) + "' " +
"and " +
"date <= DATE '" + FORMAT.format(upper.getTime()) + "'";
Query q = qm.createQuery(sql, Query.SQL);
System.out.println("result size: " + q.execute().getNodes().getSize());
}
}