简体   繁体   中英

In this query I'm getting error

In this query:

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)";

I'm getting error:

unexpected token: category near line 1, column 22 [select BookCategory category from com.xtr.schoolmanager.domain.facility.library.LibraryBook ,com.xtr.schoolmanager.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)]; nested exception is org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected token: category near line 1, column 22 [select BookCategory category from com.xtr.schoolmanager.domain.facility.library.LibraryBook ,com.xtr.schoolmanager.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)]

Please help me to get a correct answer for this.

This is the problem:

select  BookCategory category

I'm guessing you want to select the category column from BookCategory table? In which case it should read:

select  BookCategory.category

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM