休眠查询中的错误:SQL错误:156,SQLState:S0001

该错误将在运行时出现。请帮助我理解问题。 我正在使用Microsoft SQL Server

@Query("SELECT p from Product p JOIN FETCH StoreProductAvailability as spaFirst JOIN FETCH p.colors c WHERE spaFirst.available = true AND spaFirst.colorId <> 'null' AND spaFirst.colorId is not null and spaFirst.storeId = :storeId AND p.id = spaFirst.articleId AND c.colorId in (SELECT spaSecond.colorId from StoreProductAvailability spaSecond WHERE spaSecond.available = true AND spaSecond.colorId <> 'null' AND spaSecond.colorId is not null and spaSecond.storeId = :storeId and spaSecond.articleId = spaFirst.articleId)")
List<Product> findBlabla(int storeId);
Hibernate: select product0_.article_id as article_1_0_0_, colors2_.id as id1_2_1_, product0_.article_info as article_3_0_0_, product0_.commodity_group_id as commodit7_0_0_, product0_.info1 as info4_0_0_, product0_.material as material5_0_0_, product0_.article_name as article_2_0_0_, product0_.price as price6_0_0_, product0_.size_id as size_id8_0_0_, colors2_.color_id as color_id2_2_1_, colors2_.color_name as color_na3_2_1_, colors2_.article_id as article_4_2_1_, colors2_.article_id as article_4_2_0__, colors2_.id as id1_2_0__ from sf_article product0_ inner join sf_color_article_mapping colors2_ on product0_.article_id=colors2_.article_id inner join sf_store_product_availability_formatted storeprodu1_ on where storeprodu1_.available=1 and storeprodu1_.color_id<>'null' and (storeprodu1_.color_id is not null) and storeprodu1_.customer_id=? and product0_.article_id=storeprodu1_.article_id and (colors2_.color_id in (select storeprodu3_.color_id from sf_store_product_availability_formatted storeprodu3_ where storeprodu3_.available=1 and storeprodu3_.color_id<>'null' and (storeprodu3_.color_id is not null) and storeprodu3_.customer_id=? and storeprodu3_.article_id=storeprodu1_.article_id))
2020-04-08 22:09:33.258  WARN 6060 --- [nio-8080-exec-3] o.h.engine.jdbc.spi.SqlExceptionHelper   : SQL Error: 156, SQLState: S0001
2020-04-08 22:09:33.259 ERROR 6060 --- [nio-8080-exec-3] o.h.engine.jdbc.spi.SqlExceptionHelper   : Falsche Syntax in der Nähe des where-Schlüsselworts.

评论