Configuration configuration = new Configuration().configure();
SessionFactory sessionFactory = configuration.buildSessionFactory();
Session session = sessionFactory.openSession();
String hqlString = "from Book where bookType:BookType";
Query query = session.createQuery(hqlString);
query.setInteger("bookType", 1);
List<BookInfo> bookTypeArrayList = query.list();
session.close();
return bookTypeArrayList;
Book是Pojo不是表名~~~~~~
运行时报unexpected token: : near line 1, column 38 [from com.po.BookType where bookTypeID:bookTypeID]
Configuration configuration = new Configuration().configure();
SessionFactory sessionFactory = configuration.buildSessionFactory();
Session session = sessionFactory.openSession();
String hqlString = "from BookType where bookType:BookType";
Query query = session.createQuery(hqlString);
query.setInteger("bookType", 1);
List<BookInfo> bookTypeArrayList = query.list();
session.close();
return bookTypeArrayList;
BookType是Pojo不是表名~~~~~~
hibernate 中使用where 报unexpected token错误。
答案:3 悬赏:40 手机版
解决时间 2021-04-10 22:50
- 提问者网友:泪痣哥哥
- 2021-04-09 22:35
最佳答案
- 五星知识达人网友:逐風
- 2021-04-09 23:39
String hqlString = "from Book where bookType:BookType";
改成
String hqlString = "from Book where bookType = :BookType";
改成
String hqlString = "from Book where bookType = :BookType";
全部回答
- 1楼网友:荒野風
- 2021-04-10 01:56
vue中使用.扩展符为什么会报unexpected token的语法错误那就应该是babelrc的配置问题了,调整一下babel的依赖和配置吧
- 2楼网友:往事隔山水
- 2021-04-10 00:26
from com.po.BookType where bookTypeID:bookTypeID
不确定有这种用法。。。。
最好把错误日志都贴出来给看看
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯