读书人

好不容易把sql语句写出来不知道用hi

发布时间: 2013-12-04 17:21:02 作者: rapoo

好不容易把sql语句写出来,不知道用hibernate的hql语句怎么写
"select * from homework where studentcontent is null and title not in(select title from homework where studentid="+id+")";
在这里卡住了,转成hql不知道怎么写。

而直接用sql的话却出现:
No Dialect mapping for JDBC type: -1
No Dialect mapping for JDBC type: -1; nested exception is org.hibernate.MappingException: No Dialect mapping for JDBC type: -1

深夜了,早上起来解决问题。
[解决办法]
select * from homework where studentcontent is null and title not in(select title from homework where studentid="+id+")和这个sql差不多啊,另外你sql语言这么写就行了吧:
select * from homework where studentcontent is null and studentid not like "+id+";你那个title not in (select title from homework where studentid="+id+")不就是找到studentid not like "id"的条件嘛。。。

读书人网 >Java Web开发

热点推荐