1
다음과 같이 I는 MySQL 데이터 테이블 이슈가 있다고 가정하자 : 상기 쿼리querydsl에서 mysql now() 함수를 사용하는 방법은 무엇입니까?
artifact_id의 VARCHAR (50)
locked_status 숯 (1)
valid_till 날짜 시간
Select artifact_id from artifact where locked_status='Y'
, 나는 다음과 같이 querydsl 표현을 가지고있다 :
SQLTemplates templates = new MySQLTemplates();
Configuration configuration = new Configuration(templates);
QArtifact artifact = new QArtifact("a");
SQLQuery<?> query = new SQLQuery<Void>(con, templates);
List<String> artifactIds = query.select(artifact.artifact_id)
.from(artifact)
.where(artifact.locked_status.eq("Y"))
.fetch();
querydsl에서 아래 쿼리를 어떻게 표현할 수 있습니까?
Select artifact_id from artifact where locked_status='Y' and valid_till > now()
이 오류 발생 - Expressions.currentTimestamp() 옵션을 사용할 때 유형 TemporalExpression의 after (Timestamp) 메소드는 인수 (DateTimeExpression )에 적용 할 수 없습니다. –
Vedha
좋습니다. 다음을 시도하십시오 :'DateTimeExpression.currentTimestamp (Timestamp.class)'. 실제로 매개 변수로 다른 클래스가있는 두포의 위 표현과 같습니다. – Simon
예상대로 작동했습니다. – Vedha