关于hibernate查询问题!急!在线等!!!!!!!!!!!!!!!!!!!
//根据解压出来的文件查找文件夹名和截取出来的字符串相同的且层级比当前文件层级小1的文件夹(所属同一个解压文件)
    @SuppressWarnings("unchecked")
    public List<DpFolders> findByDpDocuments(String dpfname, int fileLevel, Documents documents) {
        System.out.println("进入方法进行查找");
        return super.getHibernateTemplate().find("from DpFolder where dpfname="+dpfname+"and fileLevel="+fileLevel+"and documents_id="+documents.getDid());
    }

会报错:
Struts Problem Report

Struts has detected an unhandled exception:
Messages:

unexpected token: fileLevel near line 1, column 41 [from DpFolder where dpfname=__MACOSXand fileLevel=0and documents_id=1334]
unexpected token: fileLevel near line 1, column 41 [from DpFolder where dpfname=__MACOSXand fileLevel=0and documents_id=1334]; nested exception is org.hibernate.hql.ast.QuerySyntaxException: unexpected token: fileLevel near line 1, column 41 [from DpFolder where dpfname=__MACOSXand fileLevel=0and documents_id=1334]

File: org/hibernate/hql/ast/QuerySyntaxException.java
Line number: 54
Stacktraces
org.springframework.orm.hibernate3.HibernateQueryException: unexpected token: fileLevel near line 1, column 41 [from DpFolder where dpfname=__MACOSXand fileLevel=0and documents_id=1334]; nested exception is org.hibernate.hql.ast.QuerySyntaxException: unexpected token: fileLevel near line 1, column 41 [from DpFolder where dpfname=__MACOSXand fileLevel=0and documents_id=1334]

org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:657)
org.springframework.orm.hibernate3.HibernateAccessor.convertHibernateAccessException(HibernateAccessor.java:412)
org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:424)
org.springframework.orm.hibernate3.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:374)
org.springframework.orm.hibernate3.HibernateTemplate.find(HibernateTemplate.java:921)
org.springframework.orm.hibernate3.HibernateTemplate.find(HibernateTemplate.java:913)
com.know.dao.DocumentsDaoImp.findByDpDocuments(DocumentsDaoImp.java:108)
com.know.service.DocumentsServiceImp.findByDpDocuments(DocumentsServiceImp.java:91)
com.know.action.DocumentsAction.decompression(DocumentsAction.java:263)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

1个回答

and前面加个空格。。。

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐