[英]PSQLException: ERROR: syntax error at or near "."
I'm using Java 8, Spring Boot, and PostgreSQL.我正在使用 Java 8、Spring 引导和 PostgreSQL。
I have the following query我有以下查询
@Query(value = "select mc from MasterCourse mc " +
"where mc.institution.guid = :institutionGuid or mc.consortium = true " +
"and (:searchStr in (mc.tags) " +
"or lower(mc.name) like concat('%', lower(:searchStr),'%') " +
"or lower(mc.description) like concat('%', lower(:searchStr),'%') " +
"or (:searchStr) in (mc.categories) " +
"or (:searchStr) in (mc.levels)"+
"or mc.authorGuid in (:authorGuids))"
and it is giving me an error PSQLException: ERROR: syntax error at or near "."
它给了我一个错误
PSQLException: ERROR: syntax error at or near "."
I can't seem to figure out what is causing this.我似乎无法弄清楚是什么原因造成的。 It does not appear to be any reserved words.
它似乎不是任何保留字。
Any help would be appreciated.任何帮助,将不胜感激。 If you need additional information, please let me know and I can get that asap.
如果您需要更多信息,请告诉我,我会尽快得到。
EDIT:编辑:
So I turned on debug logs and got this executed SQL.所以我打开了调试日志并得到了这个执行 SQL。 It looks like it's not liking my
and (:searchStr in (mc.tags)
. mc.tags appears to just be returning a (.). I'm guessing this is because of the fact that tags is a list of objects, not just strings.看起来它不喜欢我的
and (:searchStr in (mc.tags)
。mc.tags 似乎只是返回一个 (.)。我猜这是因为标签是一个对象列表,而不是只是字符串。
I'm trying to match the searchStr on the "name" field of the tags.我正在尝试在标签的“名称”字段上匹配 searchStr。 Any ideas on how to achieve this?
关于如何实现这一目标的任何想法?
where mastercour0_1_.institution_id=institutio1_.id and
mastercour0_.id=tags2_.master_course_id and tags2_.tag_id=tag3_.id and mastercour0_.id=categories4_.master_course_id and
categories4_.category_id=category5_.id and
mastercour0_.id=levels6_.master_course_id and
levels6_.level_id=level7_.id and (institutio1_.guid=? or mastercour0_.consortium=true
and (? in (.))
or lower(mastercour0_.name) like ('%'||lower(?)||'%')
or lower(mastercour0_.description) like ('%'||lower(?)||'%')
or ? in (.) or ? in (.) or mastercour0_.author_guid in (null))
||
||
operator instead of concat function, but that's personal preference.(mc.levels)"+
(mc.levels)"+
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.