[JIRA] (HSEARCH-3905) exists() predicate ignores dynamic fields among children of the targeted object field with the Lucene backend
by Yoann Rodière (JIRA)
Yoann Rodière ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%... ) *created* an issue
Hibernate Search ( https://hibernate.atlassian.net/browse/HSEARCH?atlOrigin=eyJpIjoiZTU2NDc1... ) / Bug ( https://hibernate.atlassian.net/browse/HSEARCH-3905?atlOrigin=eyJpIjoiZTU... ) HSEARCH-3905 ( https://hibernate.atlassian.net/browse/HSEARCH-3905?atlOrigin=eyJpIjoiZTU... ) exists() predicate ignores dynamic fields among children of the targeted object field with the Lucene backend ( https://hibernate.atlassian.net/browse/HSEARCH-3905?atlOrigin=eyJpIjoiZTU... )
Issue Type: Bug Affects Versions: 6.0.0.Beta7 Assignee: Unassigned Components: backend-lucene Created: 30/Apr/2020 00:36 AM Fix Versions: 6.0.0.Beta-backlog-low-priority Priority: Major Reporter: Yoann Rodière ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%... )
With the Lucene backend, we don't have any idea of what dynamic fields have been added to the index before the last restart of the application; we just know of dynamic fields that have been mentioned by the user (during indexing/search) since the last restart.
When we build an exists predicate for an object field, what we do internally is building a boolean query with should clauses, where each clauses tests if a "leaf" field exists. When there are dynamic fields, we don't know the full list of leaf fields, and thus we cannot properly build the exists predicate: the dynamic fields are ignored.
Solution 1: persisted metamodel
-------------------------------
The most obvious solution would be to persist a list of indexed dynamic fields *somewhere* , and read that list on bootstrap. In short, introduce a persisted metamodel for the Lucene backend.
I'm not a fan of this approach because of the added complexity for just one single feature.
Solution 2: relaxed exists() matching rules
-------------------------------------------
A perhaps easier solution would be to relax the exists() matching rules, and declare that exists() matches an object field if it was non-null when indexing. Basically:
* For nested object fields we would just run a MatchAllDocs() query within the join: if there is a nested document, the field exists.
* For flattened object fields we would have to store the list of object fields added to a given document in a specific field, and query that field. I suppose there would be an overhead at indexing time, but we already do that for other field types; see the uses of org.hibernate.search.backend.lucene.lowlevel.common.impl.MetadataFields#fieldNamesFieldName().
As an added benefit, this would immediately solve HSEARCH-3904 ( https://hibernate.atlassian.net/browse/HSEARCH-3904 ) Open (take into account dynamic fields in exists() predicate on object fields) for the Lucene backend.
The main drawback is that the behavior would be different from that of Elasticsearch, which only matches object fields when they have at least one non-null non-object child. But in a way, isn't that just a limitation of Elasticsearch?
( https://hibernate.atlassian.net/browse/HSEARCH-3905#add-comment?atlOrigin... ) Add Comment ( https://hibernate.atlassian.net/browse/HSEARCH-3905#add-comment?atlOrigin... )
Get Jira notifications on your phone! Download the Jira Cloud app for Android ( https://play.google.com/store/apps/details?id=com.atlassian.android.jira.... ) or iOS ( https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=EmailN... ) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100125- sha1:c543463 )
4 years, 8 months
[JIRA] (HHH-13987) LocalDate is affected by timezone conversions
by Vlad Mihalcea (JIRA)
Vlad Mihalcea ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%... ) *closed* an issue as *Rejected*
This was caused by a MySQL Connector/J bug that was fixed in 8.0.20 ( https://dev.mysql.com/doc/relnotes/connector-j/8.0/en/news-8-0-20.html ) :
When a Calendar was not used, a java.sql.Date value could not always be stored into and then retrieved from a MySQL server consistently. It was because Connector/J always converted a Date value to the server's time zone when storing it on the server as a MySQL DATE; but since a MySQL DATE does not have any time value, the hour, minute, and second parts of the original date was effectively lost. If the converted value is one day ahead of or behind the original value, when the value was retrieved through Connector/J and converted back to the local time zone, there was no time value for adjusting the date back to its original value, resulting in a one-day error. With this fix, any Date value is converted to MySQL DATE value using the JVM's time zone, so that the value is always consistent when being stored and then read back.
Also, the cacheDefaultTimezone connection property, previously removed from Connector/J 8.0, has now been restored so that when it is set to false, Connector/J becomes aware of the time zone changes of the JVM during runtime and converts dates with the updated time zone. (Bug #28125069, Bug #91112)
Hibernate ORM ( https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiMzc2ZjdkYmRk... ) / Bug ( https://hibernate.atlassian.net/browse/HHH-13987?atlOrigin=eyJpIjoiMzc2Zj... ) HHH-13987 ( https://hibernate.atlassian.net/browse/HHH-13987?atlOrigin=eyJpIjoiMzc2Zj... ) LocalDate is affected by timezone conversions ( https://hibernate.atlassian.net/browse/HHH-13987?atlOrigin=eyJpIjoiMzc2Zj... )
Change By: Vlad Mihalcea ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%... ) Resolution: Rejected Status: Open Closed
( https://hibernate.atlassian.net/browse/HHH-13987#add-comment?atlOrigin=ey... ) Add Comment ( https://hibernate.atlassian.net/browse/HHH-13987#add-comment?atlOrigin=ey... )
Get Jira notifications on your phone! Download the Jira Cloud app for Android ( https://play.google.com/store/apps/details?id=com.atlassian.android.jira.... ) or iOS ( https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=EmailN... ) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100125- sha1:e06514a )
4 years, 8 months
[JIRA] (HHH-13990) org.hibernate.QueryException occurs When Join Fetch is used on toOne relationship along with memberOf filter on Element collection
by Chandrasekar Rajasekar (JIRA)
Chandrasekar Rajasekar ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=5ea9ddf... ) *updated* an issue
Hibernate ORM ( https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiZDY1ZDE5MTcw... ) / Bug ( https://hibernate.atlassian.net/browse/HHH-13990?atlOrigin=eyJpIjoiZDY1ZD... ) HHH-13990 ( https://hibernate.atlassian.net/browse/HHH-13990?atlOrigin=eyJpIjoiZDY1ZD... ) org.hibernate.QueryException occurs When Join Fetch is used on toOne relationship along with memberOf filter on Element collection ( https://hibernate.atlassian.net/browse/HHH-13990?atlOrigin=eyJpIjoiZDY1ZD... )
Change By: Chandrasekar Rajasekar ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=5ea9ddf... )
Query exception error occurs when element collection is included in where clause along with join fetch.
{noformat} SELECT example_Book FROM example.Author example_Author_fetch JOIN example_Authorfetch.books example_Book LEFT JOIN FETCH example_Book.publisher WHERE :awards_3b62d810_0 MEMBER OF example_Book.awards AND example_Authorfetch=:example_Author_fetch{noformat}
java.lang.IllegalArgumentException: org.hibernate.QueryException: query specified join fetching, but the owner of the fetched association was not present in the select list \ [FromElement \ {explicit,not a collection join,fetch join,fetch non-lazy properties,classAlias=null,role=example.Book.publisher,tableName=Publisher,tableAlias=publisher3_,origin=author author0_,columns= \ {book2_.publisher_id ,className=example.Publisher}}] \ [SELECT example_Book FROM example.Author example_Author_fetch JOIN example_Authorfetch.books example_Book LEFT JOIN FETCH example_Book.publisher WHERE :awards_3b62d810_0 MEMBER OF example_Book.awards AND example_Authorfetch=:example_Author_fetch ] {noformat}
{noformat}SELECT example_Book FROM example.Author example_Author_fetch JOIN example_Authorfetch.books example_Book LEFT JOIN FETCH example_Book.publisher WHERE :awards_3b62d810_0 MEMBER OF example_Book.awards AND example_Authorfetch=:example_Author_fetch`{noformat}
Book and author has many-many relationship and book and publisher has many-one relationship. Awards is a Element collection of type List<string>.
Some of working queries:
{noformat}SELECT example_Book FROM example.Book AS example_Book LEFT JOIN FETCH example_Book.publisher WHERE :awards_3e8093d5_0 MEMBER OF example_Book.awards `{noformat}
{noformat}SELECT example_Book FROM example.Author example_Author_fetch JOIN example_Authorfetch.books example_Book LEFT JOIN FETCH example_Book.publisher WHERE example_Book.publishDate > 😛ublishDate_fd2879ac_0 AND example_Authorfetch=:example_Author_fetch`{noformat}
( https://hibernate.atlassian.net/browse/HHH-13990#add-comment?atlOrigin=ey... ) Add Comment ( https://hibernate.atlassian.net/browse/HHH-13990#add-comment?atlOrigin=ey... )
Get Jira notifications on your phone! Download the Jira Cloud app for Android ( https://play.google.com/store/apps/details?id=com.atlassian.android.jira.... ) or iOS ( https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=EmailN... ) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100125- sha1:e06514a )
4 years, 8 months
[JIRA] (HHH-13990) org.hibernate.QueryException occurs When Join Fetch is used on toOne relationship along with memberOf filter on Element collection
by Chandrasekar Rajasekar (JIRA)
Chandrasekar Rajasekar ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=5ea9ddf... ) *updated* an issue
Hibernate ORM ( https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiNDlkYjVlMjBl... ) / Bug ( https://hibernate.atlassian.net/browse/HHH-13990?atlOrigin=eyJpIjoiNDlkYj... ) HHH-13990 ( https://hibernate.atlassian.net/browse/HHH-13990?atlOrigin=eyJpIjoiNDlkYj... ) org.hibernate.QueryException occurs When Join Fetch is used on toOne relationship along with memberOf filter on Element collection ( https://hibernate.atlassian.net/browse/HHH-13990?atlOrigin=eyJpIjoiNDlkYj... )
Change By: Chandrasekar Rajasekar ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=5ea9ddf... )
Query exception error occurs when element collection is included in where clause along with join fetch.
```
{noformat} java.lang.IllegalArgumentException: org.hibernate.QueryException: query specified join fetching, but the owner of the fetched association was not present in the select list [FromElement{explicit,not a collection join,fetch join,fetch non-lazy properties,classAlias=null,role=example.Book.publisher,tableName=Publisher,tableAlias=publisher3_,origin=author author0_,columns={book2_.publisher_id ,className=example.Publisher}}] [SELECT example_Book FROM example.Author example_Author__fetch example_Author_fetch JOIN example_Author__fetch example_Authorfetch.books example_Book LEFT JOIN FETCH example_Book.publisher WHERE :awards_3b62d810_0 MEMBER OF example_Book.awards AND example_Author__fetch example_Authorfetch =: example_Author__fetch example_Author_fetch ] ``` {noformat}
` {noformat} SELECT example_Book FROM example.Author example_Author__fetch example_Author_fetch JOIN example_Author__fetch example_Authorfetch.books example_Book LEFT JOIN FETCH example_Book.publisher WHERE :awards_3b62d810_0 MEMBER OF example_Book.awards AND example_Author__fetch example_Authorfetch =: example_Author__fetch example_Author_fetch ` {noformat}
Book and author has many-many relationship and book and publisher has many-one relationship. Awards is a Element collection of type List<string>.
Some of working queries:
`
{noformat} SELECT example_Book FROM example.Book AS example_Book LEFT JOIN FETCH example_Book.publisher WHERE :awards_3e8093d5_0 MEMBER OF example_Book.awards ` {noformat}
`
{noformat} SELECT example_Book FROM example.Author example_Author__fetch example_Author_fetch JOIN example_Author__fetch example_Authorfetch.books example_Book LEFT JOIN FETCH example_Book.publisher WHERE example_Book.publishDate > :publishDate_fd2879ac_0 😛ublishDate_fd2879ac_0 AND example_Author__fetch example_Authorfetch =: example_Author__fetch example_Author_fetch ` {noformat}
( https://hibernate.atlassian.net/browse/HHH-13990#add-comment?atlOrigin=ey... ) Add Comment ( https://hibernate.atlassian.net/browse/HHH-13990#add-comment?atlOrigin=ey... )
Get Jira notifications on your phone! Download the Jira Cloud app for Android ( https://play.google.com/store/apps/details?id=com.atlassian.android.jira.... ) or iOS ( https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=EmailN... ) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100125- sha1:e06514a )
4 years, 8 months