[hibernate-dev] document update change?
Ales Justin
ales.justin at gmail.com
Thu Apr 2 15:00:33 EDT 2015
When debugging, I see this -- it get "bbb" twice (old and new, where I would actually expect stale "ccc"):
results = {java.util.ArrayList at 17380} size = 3
0 = {java.lang.Object[3]@17384}
0 = {com.google.appengine.api.datastore.Key at 17395} "test(1)"
1 = {java.lang.String at 17396} "#Thu Apr 02 20:53:33 CEST 2015\nprop=STRING\n"
2 = {java.lang.String at 17397} "040:aaa"
1 = {java.lang.Object[3]@17385}
0 = {com.google.appengine.api.datastore.Key at 17391} "test(1)"
1 = {java.lang.String at 17392} "#Thu Apr 02 20:51:24 CEST 2015\nprop=STRING\n"
2 = {java.lang.String at 17393} "040:bbb"
2 = {java.lang.Object[3]@17386}
0 = {com.google.appengine.api.datastore.Key at 17387} "test(1)"
1 = {java.lang.String at 17388} "#Thu Apr 02 20:53:33 CEST 2015\nprop=STRING\n"
2 = {java.lang.String at 17389} "040:bbb"
But still no idea on why dup "bbb" is there ...
-Ales
> On 01 Apr 2015, at 11:59, Ales Justin <ales.justin at gmail.com> wrote:
>
> Did entity updating changed in HS5 / Lucene4?
> (aka Document updating)
>
> Since this used to work for us (with HS4, Lucene3):
>
> ---
> @Test
> public void testProjectionQueriesHandleEntityModificationProperly() throws Exception {
> Entity e = createEntity("test", 1)
> .withProperty("prop", Arrays.asList("aaa", "bbb", "ccc"))
> .store();
>
> Query query = new Query("test")
> .addProjection(new PropertyProjection("prop", String.class))
> .addSort("prop");
>
> assertEquals(3, service.prepare(query).asList(withDefaults()).size());
>
> e = createEntity(e.getKey())
> .withProperty("prop", Arrays.asList("aaa", "bbb"))
> .store();
>
> assertEquals(2, service.prepare(query).asList(withDefaults()).size());
>
> service.delete(e.getKey());
>
> assertEquals(0, service.prepare(query).asList(withDefaults()).size());
> }
>
> ---
>
> Where we add each list/collection value under same field:
>
> if (propertyValue instanceof Collection) {
> Collection collection = (Collection) propertyValue;
> for (Object element : collection) {
> if (PropertyUtils.isIndexedProperty(element)) {
> final Bridge inner = BridgeUtils.matchBridge(element);
> luceneOptions.addFieldToDocument(propertyName, inner.objectToString(element), document);
> }
> }
>
> ---
>
> As it looks like the update still keeps the old values around:
>
> java.lang.AssertionError: expected:<2> but was:<3>
> at org.junit.Assert.fail(Assert.java:88)
> at org.junit.Assert.failNotEquals(Assert.java:743)
> at org.junit.Assert.assertEquals(Assert.java:118)
> at org.junit.Assert.assertEquals(Assert.java:555)
> at org.junit.Assert.assertEquals(Assert.java:542)
> at org.jboss.test.capedwarf.datastore.test.QueryOptimizationsTest.testProjectionQueriesHandleEntityModificationProperly(QueryOptimizationsTest.java:510)
>
> ---
>
> Any way to force / fix this?
>
> -Ales
>
More information about the hibernate-dev
mailing list