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 Java 8 JSR 310 compatibility #47

Open
aadrian opened this issue Oct 27, 2017 · 4 comments
Open

Add Java 8 JSR 310 compatibility #47

aadrian opened this issue Oct 27, 2017 · 4 comments

Comments

@aadrian
Copy link
Member

aadrian commented Oct 27, 2017

Add Java 8 JSR 310 compatibility.

@MasatoshiTada
Copy link

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.

@takezoe
Copy link
Member

takezoe commented Nov 8, 2017

Just adding new ValueTypes to mirage module.

Looks good. What do you think? @aadrian

@aadrian
Copy link
Member Author

aadrian commented Nov 8, 2017

@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.

@aadrian aadrian changed the title Add Java 9 compatiblity Add Java 8 JSR 310 compatibility Nov 8, 2017
@MasatoshiTada
Copy link

MasatoshiTada commented Nov 13, 2017

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants