在此查询中:
String sql="select BookCategory category from LibraryBook,BookMaster,BookCategory where (LibraryBook.id="+bookid+" AND LibraryBook.BookMaster.id=BookMaster.id AND BookMaster.BookCategory.id=BookCategory.id)";
我收到错误:
意外标记:第1行第22列附近的类别[从com.xtr.schoolmanager.domain.facility.library.LibraryBook,com.xtr.schoolmanager.domain.facility.library.BookMaster,com.xtr中选择BookCategory类别。 schoolmanager.domain.facility.library.BookCategory where(LibraryBook.id = 18 AND LibraryBook.BookMaster.id = BookMaster.id AND BookMaster.BookCategory.id = BookCategory.id)];嵌套异常是org.hibernate.hql.internal.ast.QuerySyntaxException:意外标记:第1行第22列附近的类别[从com.xtr.schoolmanager.domain.facility.library.LibraryBook,com.xtr.schoolmanager中选择BookCategory类别。 domain.facility.library.BookMaster,com.xtr.schoolmanager.domain.facility.library.BookCategory where(LibraryBook.id = 18 AND LibraryBook.BookMaster.id = BookMaster.id AND BookMaster.BookCategory.id = BookCategory.id)]
请帮助我为此得到正确的答案。
答案 0 :(得分:0)
这是问题所在:
select BookCategory category
我猜你要从category
表中选择BookCategory
列?在这种情况下,它应该是:
select BookCategory.category