-
Notifications
You must be signed in to change notification settings - Fork 6
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
Ojdbc provider jackson oson #118
base: main
Are you sure you want to change the base?
Conversation
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.
Looks fantastic, thank you for doing this. Most of my comments are trivial, please see the one about UUID serialization though.
...c-provider-samples/src/main/java/oracle/jdbc/provider/oson/sample/JacksonOsonSampleUtil.java
Outdated
Show resolved
Hide resolved
ojdbc-provider-jackson-oson/src/main/java/oracle/jdbc/provider/oson/OsonGenerator.java
Show resolved
Hide resolved
@Override | ||
public void writeUTF8String(byte[] buffer, int offset, int len) throws IOException { | ||
_verifyValueWrite("writeUTF8String"); | ||
gen.write(new String(buffer, offset, len, StandardCharsets.UTF_8)); |
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.
OsonParserImpl and OsonGeneratorImpl have the ability to do UTF8 passthrough. See:
https://codesearch.oraclecorp.com/cs/xref/RDBMS_MAIN_LINUX.X64/dbjava/src/java/oracle/jdbc/driver/json/binary/OsonGeneratorImpl.java#2175
It would be great if we expose these methods and use them here to avoid string construction.
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.
These will have to be done on another version, since it would require changes to the driver
@@ -0,0 +1,57 @@ | |||
# OSON Provider for Jackson |
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.
Nice README. It would be great if you could include a definition of the type mappings, i.e. a table with one column that lists Java types and the default OSON mapping.
Also if I want to override a mapping for some field and gain access to the underlying OracleJsonParser and OracleJsonGenerator is this possible?
protected void _verifyValueWrite(String typeMsg) throws IOException { | ||
int status = _writeContext.writeValue(); | ||
if(status == _writeContext.STATUS_EXPECT_NAME) { | ||
_reportError("error: expecting value. Got name: " + typeMsg); |
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.
Should these strings be externalized for translation?
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.
For now error messages are not translated in the extensions.
* of the JSON object. | ||
* </p> | ||
*/ | ||
public class AccessJsonColumnUsingJacksonObjectNode { |
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 think that this example should point out that this is only recommended if some existing API requires to consume the data as ObjectNode. Otherwise, it would be better to use OracleJsonObject as this will provide in-place reads of the underlying data without making a copy and it will better expose the underlying type system.
public static void main(String[] args) { | ||
try { | ||
// set the system property to the class implementing the "oracle.jdbc.spi.JsonProvider interface" | ||
System.setProperty(OracleConnection.CONNECTION_PROPERTY_PROVIDER_JSON, JacksonOsonProvider.PROVIDER_NAME); |
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.
Does this have to be done by system property?
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.
No, it can also be added as connection property, I have changed the samples.
...src/main/java/oracle/jdbc/provider/oson/sample/AccessJsonColumnUsingPOJOAndJsonProvider.java
Show resolved
Hide resolved
* Teking into account samples review comments * Added Copyright
…ta annotations. Added more Tests.
...rovider-jackson-oson/src/main/java/oracle/jdbc/provider/oson/deser/OsonUUIDDeserializer.java
Outdated
Show resolved
Hide resolved
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.
This is really great work, Please take a look at my review comments. Some of them, such as those related to indentation (2), line length (80-character limit), and copyright formatting, might apply to multiple places across the files.
ojdbc-provider-jackson-oson/src/main/java/oracle/jdbc/provider/oson/Util.java
Show resolved
Hide resolved
ojdbc-provider-jackson-oson/src/main/java/oracle/jdbc/provider/oson/OsonFactory.java
Outdated
Show resolved
Hide resolved
ojdbc-provider-jackson-oson/src/main/java/oracle/jdbc/provider/oson/OsonGenerator.java
Outdated
Show resolved
Hide resolved
ojdbc-provider-jackson-oson/src/main/java/oracle/jdbc/provider/oson/OsonModule.java
Outdated
Show resolved
Hide resolved
ojdbc-provider-jackson-oson/src/main/java/oracle/jdbc/provider/oson/OsonModule.java
Outdated
Show resolved
Hide resolved
...ider-jackson-oson/src/main/java/oracle/jdbc/provider/oson/deser/OsonBooleanDeserializer.java
Outdated
Show resolved
Hide resolved
...er-jackson-oson/src/main/java/oracle/jdbc/provider/oson/deser/OsonLocalDateDeserializer.java
Outdated
Show resolved
Hide resolved
...ackson-oson/src/main/java/oracle/jdbc/provider/oson/deser/OsosnSerializableDeserializer.java
Outdated
Show resolved
Hide resolved
ojdbc-provider-jackson-oson/src/test/java/oracle/jdbc/provider/oson/test/MultiThreadTest.java
Show resolved
Hide resolved
ojdbc-provider-samples/src/main/java/oracle/jdbc/provider/oson/sample/model/Emp.java
Show resolved
Hide resolved
Can't wait for this to be merged! |
No description provided.