日期:2014-05-17  浏览次数:20700 次

好不容易把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"的条件嘛。。。