ssh中多表查询及Path expected for join的异常处理

1.ssh介绍

   在ssh中我们通常会将其分为pojo,dao,daoimpl,service,serviceimpl和action层,当然还包括xml配置文件及pd.properties文件。在近期做的项目中通过ssh框架搭建了后台框架以及功能的实现,发现ssh中主要需要注意对xml映射方面进行多加注意。

2.查询内容

本次用到的查询是多表查询,如shift和station的实体类存在多表查询的内容

2.1 多表的内容

在查询内容是主要涉及station和shift表中存在多对一的关系,同时需要station和shift表中的部分内容,即通过station中stationName来查询各种内容

2.2 多表查询的方法

查询的方法为from Shift s left join Station departStation where s.departStation .stationId=s.id and departStation .stationId=2

2.3多表查询遇到的问题及解决办法

在中途会遇到Path expected for join的异常,通常会将其改为from Shift where departStation is null or departStation.stationName like '%"+stationName+"%',另外'%"+stationName+"%'在其中不可写成'%stationName%',否则会报错

2.4 一些问题

 如果是两个Station的类该如何解决?

 

posted @ 2017-08-08 23:28  wanglele1988  阅读(389)  评论(0编辑  收藏  举报