[
https://issues.apache.org/jira/browse/RANGER-4104?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17692264#comment-17692264
]
Andrew Luo commented on RANGER-4104:
------------------------------------
I didn't try reproducing on other databases but it is reproducible on MySQL.
If you login and look at the actual JDBC query generated in the log, you will
see that the format of the date is incorrect.
If you don't specify the TemporalType.DATE parameter, then it will use the
default parameter type conversion in JDBC 4.2 Appendix B.4 which specifies that
java.util.Date is mapped to TIMESTAMP type. If you use java.sql.Date then it's
mapped to DATE type. So either we should add the TemporalType.DATE parameter
or convert to java.sql.Date in the getRecentAuthFailureCountByLoginId method.
> XXAuthSessionDao.getRecentAuthFailureCountByLoginId produces incorrect SQL
> code
> -------------------------------------------------------------------------------
>
> Key: RANGER-4104
> URL: https://issues.apache.org/jira/browse/RANGER-4104
> Project: Ranger
> Issue Type: Bug
> Components: admin
> Affects Versions: 3.0.0, 2.4.0
> Reporter: Andrew Luo
> Priority: Major
> Attachments:
> 0001-Fix-type-of-authWindowStartTime-parameter-in-XXAuthS.patch
>
>
> XXAuthSessionDao.getRecentAuthFailureCountByLoginId produces incorrect SQL
> code due to an error in how the authWindowStartTime Date parameter is bound.
> It is currently bound with setParameter("authWindowStartTime",
> authWindowStartTime) however, [JPA 2.2 Specification Section
> 11.1.53|https://download.oracle.com/otn-pub/jcp/persistence-2_2-mrel-spec/JavaPersistence.pdf]
> says that it should be bound by specifying an additional parameter
> TemporalType.DATE.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)