日期:2014-05-18 浏览次数:20697 次
public List<CarTurn> listCarTrun(String from,
String to) {
String hql = "from CarTurn c where c.delFlag='N'";
if (null != from) {
hql += " and c.startStation.stationName like '%" + from + "%'";
}
if (null != to) {
hql += " and c.destinationStation.stationName like '%" + from
+ "%'";
}
Query query = getSession().createQuery(hql);
return query.list();
@OneToOne(cascade=CascadeType.ALL)
@JoinColumn(name="start_station_id")
private Station startStation; //出发站
@OneToOne(cascade=CascadeType.ALL)
@JoinColumn(name="destination_station_id")
private Station destinationStation; //终点站
org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected token: and near line 1, column 55 [from com.swu.kysp.domain.CarTurn c where c.delFlag='N' and c.startStation.stationName like '%%' and c.destinationStation.stationName like '%%']