-
Notifications
You must be signed in to change notification settings - Fork 11
allow null value persistence and retrieval #111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
||
private static final Set<String> COMPARISON_OPERATOR_NAMES_SUPPORTED = | ||
Set.of("$eq", "$ne", "$gt", "$gte", "$lt", "$lte"); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
HIBERNATE-74 exceptions are intertwinced with HIBERNATE-48; we have to refrain from throwing HIBERNATE-74 exceptions from JDBC flow to unblock HIBERNATE-48. For this reason, I decoupled them and created a separate HIBERNATE-74 protected mechanism as above. It is more robust and is free of cache implication.
Given HIBERNATE-74 is to be done soon, we might well simply ignore the above protection.
if (domainValue == null) { | ||
throw new FeatureNotSupportedException( | ||
"TODO-HIBERNATE-48 https://jira.mongodb.org/browse/HIBERNATE-48 return toBsonValue(domainValue)"); | ||
return null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we have to return null
instead of BsonNull
for we need to return domain value for bindValue
; Struct -> BsonDocument transformation should be the only exception; for that reason, I changed the method return type to better align with its purpose.
return extractor.getJavaType().wrap(domainObjects, options); | ||
} else { | ||
return extractor.getJavaType().wrap(array, options); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The above code changes is to bypass a newly found Hibernate ORM bug. Luckily in this case we can work around.
I created the Hibernate ORM ticket at https://hibernate.atlassian.net/browse/HHH-19596. The bugfix has been merged to both v7 and v6.6.
Just a couple of days we could eliminate the above change after a new v6.6 Hibernate ORM version is released.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I bumped the version to latest v6.6.21 and found the issue has been solved.
https://jira.mongodb.org/browse/HIBERNATE-48
The ticket has both tech design part and implementation part:
The main decisions from design are summarized as below:
The main work in this PR includes:
Some tech decisions in this PR:
@DynamicInsert
for two reasons: 1) it was disabled for protective development reason during previous PR; now the reason ceases to exist; 2) we can't avoid mixture of null and missing fields even if we disabled@DynamicInsert
for HQL partial insertion statement will end up with the mixture easily