首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >@Query不返回任何结果

@Query不返回任何结果
EN

Stack Overflow用户
提问于 2017-04-19 10:07:53
回答 1查看 108关注 0票数 1

我在存储库类中使用Spring的@Query注释。当我在PL-SQL developer中运行相同的sql时,它会返回结果,但在应用程序中不会返回结果。有什么问题吗?我怎么才能修好它?请帮帮忙。提前感谢

我的回购类:

代码语言:javascript
复制
@Repository
public interface FiberChannelRepository extends FndJpaRepositiry<FiberChannel, Long> {

  @Query("select n.id, c.id, loc from FiberChannel fc  left join Channel c on fc.id=c.id left join ChannelNode cn on c.id = cn.id and cn.deleted != true  left join Node n  on cn.id = n.id and cn.deleted != true  left join Location loc on loc.id = n.id and cn.deleted != true where fc.id=?1")
  List<Object[]> findNodesByFiber_Id(Long idFiber);

}

SQL变体:

代码语言:javascript
复制
select n.id_node, c.id_channel, loc.*
  from Fiber_Channel fc 
      left join channel c on fc.id_channel=c.id_channel  
  left join CHANNEL_NODE cn
      on c.id_channel = cn.id_channel and cn.is_deleted != 1 
  left join Node n 
      on cn.id_node = n.id_node and cn.is_deleted != 1 
  left join Location loc
      on loc.id_location = n.id_location and cn.is_deleted != 1 where 
fc.id_fiber=42266
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-04-19 10:14:05

我已经解决了我的问题。我在查询sql时出错了。我将fc.id替换为fc.fiber.id,它现在起作用了。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/43492595

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档