Code Monkey home page Code Monkey logo

Comments (4)

MasatoshiTada avatar MasatoshiTada commented on July 21, 2024

Hi,

I used Mirage-SQL for the first time recently, but I really like it.

What do you think about Date and Time API (JSR 310)?
It's not difficult because it's just adding some ValueTypes of java.time.LocalDate , java.time.LocalDateTime and so on.

Here's my sample codes.
https://github.com/MasatoshiTada/mirage-sql-sample/blob/master/src/main/java/com/example/valuetype/LocalDateValueType.java
https://github.com/MasatoshiTada/mirage-sql-sample/blob/master/src/main/java/com/example/entity/Employee.java#L9

However, I think there are two ways to achieve this (like below).

  1. Just adding new ValueTypes to mirage module.
  2. Creating new ValueTypes as separated module such as mirage-valuetypes-jsr310.

Which is better do you think?

If I can, I'd like to send PR about this matter.

from mirage.

takezoe avatar takezoe commented on July 21, 2024

Just adding new ValueTypes to mirage module.

Looks good. What do you think? @aadrian

from mirage.

aadrian avatar aadrian commented on July 21, 2024

@MasatoshiTada I think "way 1" is better.

Unfortunately not all JDBC drivers support JSR310 yet: most notably and incredibly: the Oracle DB one :( - so I think that dialect specific handling would also might be needed.

Currently we have no tests (integration) for each dialect :( . Something with https://github.com/flapdoodle-oss/de.flapdoodle.embed.process might be a good start.

from mirage.

MasatoshiTada avatar MasatoshiTada commented on July 21, 2024

Thank you for your comments!

Unfortunately not all JDBC drivers support JSR310 yet

Does this mean "resultSet.getObject(columnName, LocalDate.class) throws Exception"?
I think it is no problem if we write like below;

Date date = resultSet.getDate(columnName);
LocalDate localDate = date.toLocalDate();

MyBatis's TypeHandlers use this way.
https://github.com/mybatis/typehandlers-jsr310/tree/master/src/main/java/org/apache/ibatis/type

from mirage.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.