다음 문제가 발생했습니다. 의 지시에 게시물 필드를 게시 내 문제가 데이터베이스에서 이전 및 다음 게시물을 얻을 수 있습니다Squeryl : Option [T] where 절에있는 객체를 비교하는 방법?
case class Post (
id: Int,
slug: String,
title: String,
@Column("postText")
text: String,
isVisible: Boolean,
created: Timestamp,
lastUpdated: Timestamp,
published: Option[Timestamp]
) extends KeyedEntity[Int]
: 나는 클래스가
는 모양 포스트를 말한다. 내가 겪었던 문제는 게시 된 필드가 Option [Timestamp]입니다. 나는이 같은 Squeryl 쿼리 생성 :
val nextPost = from(postTable)(p =>
where((p.published > post.published) and p.isVisible === true)
select(p)
orderBy(p.published asc)
).page(0, 1)
을 그리고이 결과는 SQL에서 보았을 때 나는 이런 식으로 뭔가 보았다 를 "... post.published WHERE> 일부 (".... ") .. . " 물론 SQL 쿼리에서 구문 오류가 발생했습니다.
설명서를 보았지만 대답을 찾을 수 없습니다. 이미 squeryl MySQL의 쿼리 건설 명확한 버그가 있습니다
UPDATE
... 슬릭로 전환 할 생각입니다.
Select
Post9.lastUpdated as Post9_lastUpdated,
Post9.published as Post9_published,
Post9.postText as Post9_postText,
Post9.slug as Post9_slug,
Post9.id as Post9_id,
Post9.isVisible as Post9_isVisible,
Post9.title as Post9_title,
Post9.created as Post9_created
From
Post Post9
Where
((Post9.published > 2013-08-01 14:21:25.0) and (Post9.isVisible = true))
Order By
Post9.published Asc
limit 1 offset 0
볼 쿼리 생성자는 날짜를 포맷하는 방법 ...
내가 슬릭로 전환하고있다 : 나는 쿼리를 생성
val x : Timestamp = post.published.getOrElse(new Timestamp(0))
val nextPost = from(postTable)(p =>
where((p.published.getOrElse(new Timestamp(0)) > x) and p.isVisible === true)
select(p)
orderBy(p.published asc)
).page(0, 1)
으로 돌아가 셨습니다.
어떤 버전의 Squeryl이 었습니까? –
내 sbt 구성을 살펴 보았습니다. 0.9.5-6 –
이동하고 시간이 없다면 이해하지만 재현 가능한 테스트 케이스를보고 싶다면 함께 해결할 수 있습니다. 이것이 버그 인 경우. Squeryl List (https://groups.google.com/forum/#!forum/squeryl)에 여기 또는 (선호) 게시 할 수 있습니다. –