Skip to content
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

add NullableBaseTypeHandler for avoid unnecessary wasNull() call #1242

Closed
wants to merge 1 commit into from

Conversation

lseeker
Copy link

@lseeker lseeker commented Apr 4, 2018

Current MyBatis type handlers always check SQL NULL by ResultSet.wasNull() call that could decrease performance.
On my case on Oracle R12, profiling found about 30% delay on VARCHAR types by wasNull() call.

Following java.sql.ResultSet get methods are declared returns java null on SQL NULL value, so these types are can use returned null value as-is.

  • getAsciiStream()
  • getBigDecimal()
  • getBinaryStream()
  • getBytes()
  • getCharacterStream()
  • getDate()
  • getNCharacterStream()
  • getNString()
  • getRowId()
  • getString()
  • getTime()
  • getTimestamp()
  • getUnicodeStream()
  • getURL()

This pull request add NullableBaseTypeHandler class that do not call wasNull() and inherits it on TypeHandlers using above listed methods.

@harawata
Copy link
Member

harawata commented Apr 4, 2018

Thank you, @lseeker !

This seems like a nice optimization.
Any objections?

@mnesarco
Copy link
Member

mnesarco commented Apr 4, 2018 via email

@kazuki43zoo
Copy link
Member

Sounds good me too!!
However, I feel that it is better to improve the inheritance relationship.
I will submit my idea at later using other Pull Request.

kazuki43zoo added a commit to kazuki43zoo/mybatis-3 that referenced this pull request Apr 5, 2018
kazuki43zoo added a commit to kazuki43zoo/mybatis-3 that referenced this pull request Apr 5, 2018
kazuki43zoo added a commit to kazuki43zoo/mybatis-3 that referenced this pull request Apr 5, 2018
kazuki43zoo added a commit to kazuki43zoo/mybatis-3 that referenced this pull request Apr 5, 2018
kazuki43zoo added a commit to kazuki43zoo/mybatis-3 that referenced this pull request Apr 5, 2018
kazuki43zoo added a commit to kazuki43zoo/mybatis-3 that referenced this pull request Apr 5, 2018
@lseeker
Copy link
Author

lseeker commented Apr 8, 2018

@kazuki43zoo Thanks for improved work!

@lseeker lseeker closed this Apr 8, 2018
kazuki43zoo added a commit to kazuki43zoo/mybatis-3 that referenced this pull request Apr 9, 2018
kazuki43zoo added a commit to kazuki43zoo/mybatis-3 that referenced this pull request Apr 9, 2018
kazuki43zoo added a commit that referenced this pull request Apr 25, 2018
…class

Move wasNull to subclass from BaseTypeHandler #1242
pulllock pushed a commit to pulllock/mybatis-3 that referenced this pull request Oct 19, 2023
pulllock pushed a commit to pulllock/mybatis-3 that referenced this pull request Oct 19, 2023
…-to-subclass

Move wasNull to subclass from BaseTypeHandler mybatis#1242
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants