相关文章推荐
曾经爱过的西装  ·  Modern Forms Designer ...·  1 月前    · 
沉稳的木瓜  ·  Delphi 10.3.3 - Indy ...·  1 年前    · 
鼻子大的脆皮肠  ·  SwiftUI 中 ...·  1 年前    · 
傻傻的针织衫  ·  javascript - ...·  1 年前    · 

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement . We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account Page 1 of 1 containing UNKNOWN instances when findByUserNameLike(String userName,Pageable pageable) [DATAJPA-225] Page 1 of 1 containing UNKNOWN instances when findByUserNameLike(String userName,Pageable pageable) [DATAJPA-225] spring-projects-issues opened this issue Jun 24, 2012 · 3 comments

Vincent Chan opened DATAJPA-225 and commented

public interface UserRepository extends JpaRepository<User,Long> {
    public Page<User> findByUserNameLike(String userName, Pageable pageable);

and called as:

Page data=userRepository.findByUserNameLike("%"+name+"%", new PageRequest(page, pageSize, new Sort(Sort.Direction.ASC, "userName")));
return data.getContent();

When call the findByUserNameLike method,the console show:

09:45:57:772 - DEBUG - DispatcherServlet - DispatcherServlet with name 'testServlet' processing GET request for [/test/user/list.xml]
09:45:57:779 - DEBUG - AbstractHandlerMethodMapping - Looking up handler method for path /user/list.xml
09:45:57:786 - DEBUG - AbstractHandlerMethodMapping - Returning handler method [public void com.qztc.test.mvc.user.UserController.queryUser(java.lang.String,org.springframework.ui.Model,java.lang.Integer,java.lang.Integer)]
09:45:57:786 - DEBUG - DispatcherServlet - Last-Modified value for [/test/user/list.xml] is: -1
09:45:59:407 - DEBUG - SharedEntityManagerCreator$SharedEntityManagerInvocationHandler - Creating new EntityManager for shared EntityManager invocation
09:45:59:407 - DEBUG - SessionImpl - Opened session at timestamp: 13405887594
09:45:59:408 - DEBUG - CriteriaQueryCompiler - Rendered criteria query -> select count(*) from User as generatedAlias0 where generatedAlias0.userName like :param0
09:45:59:423 - DEBUG - LogicalConnectionImpl - Obtaining JDBC connection
09:45:59:424 - DEBUG - DriverManagerDataSource - Creating new JDBC DriverManager Connection to [jdbc:oracle:thin:@127.0.0.1:1521:xe]
09:45:59:478 - DEBUG - LogicalConnectionImpl - Obtained JDBC connection
09:45:59:478 - DEBUG - SqlStatementLogger - select count(*) as col_0_0_ from user useri0_ where useri0_.user_name like ?
Hibernate: select count(*) as col_0_0_ from user useri0_ where useri0_.user_name like ?
09:45:59:478 - TRACE - BasicBinder - binding parameter [1] as [VARCHAR] - %小学%
09:45:59:482 - DEBUG - Loader - Result set row: 0
09:45:59:483 - DEBUG - Loader - Result row: 
09:45:59:483 - TRACE - BasicExtractor - Found [8] as column [col_0_0_]
09:45:59:483 - DEBUG - StatefulPersistenceContext - Initializing non-lazy collections
09:45:59:484 - DEBUG - EntityManagerFactoryUtils - Closing JPA EntityManager
09:45:59:484 - DEBUG - LogicalConnectionImpl - Releasing JDBC connection
09:45:59:486 - DEBUG - LogicalConnectionImpl - Released JDBC connection
09:45:59:487 - DEBUG - ConnectionProxyHandler - HHH000163: Logical connection releasing its physical connection
09:45:59:487 - DEBUG - SharedEntityManagerCreator$SharedEntityManagerInvocationHandler - Creating new EntityManager for shared EntityManager invocation
09:45:59:487 - DEBUG - SessionImpl - Opened session at timestamp: 13405887594
09:45:59:488 - DEBUG - CriteriaQueryCompiler - Rendered criteria query -> select generatedAlias0 from User as generatedAlias0 where generatedAlias0.userName like :param0 order by generatedAlias0.userName asc
09:45:59:489 - DEBUG - ContentNegotiatingViewResolver - Requested media type is 'application/xml' (based on filename 'list.xml')
09:45:59:489 - DEBUG - ContentNegotiatingViewResolver - Returning [org.springframework.web.servlet.view.xml.MarshallingView: name 'org.springframework.web.servlet.view.xml.MarshallingView#63f5e4b6'] based on requested media type 'application/xml'
09:45:59:489 - DEBUG - DispatcherServlet - Rendering view [org.springframework.web.servlet.view.xml.MarshallingView: name 'org.springframework.web.servlet.view.xml.MarshallingView#63f5e4b6'] in DispatcherServlet with name 'testServlet'
09:45:59:490 - DEBUG - FrameworkServlet - Successfully completed request

When debug ,the page returned shows: "Page 1 of 1 containing UNKNOWN instances".

I do not know what is the problem

No further details from DATAJPA-225

Oliver Drotbohm commented

I don't know either? What problem are you actually reporting? The debug output is correct as your query doesn't seem to return any results which why we can't inspect the result's elements for the element type. This the reason the UNKNOWN is written. If there were any results you'd see Page 1 of X containing User instances