Your query looks like this: "SELECT E.username FROM MyUser E"
The E.username
part will return a list of username Strings. It should be From MyUser
to get MyUser
objects.
Something like:
List<MyUser> p1 =sn.createQuery("FROM MyUser").list();
More Related Contents:
- How to solve the “failed to lazily initialize a collection of role” Hibernate exception
- What is the proper way to re-attach detached objects in Hibernate?
- Spring: how do I inject an HttpServletRequest into a request-scoped bean?
- No Dialect mapping for JDBC type: 1111
- Annotation @Transactional. How to rollback?
- How can I get a Spring bean in a servlet filter?
- How to set up default schema name in JPA configuration?
- Transaction marked as rollback only: How do I find the cause
- Transactional saves without calling update method
- Howto get rid of ?
- Hibernate could not fetch the SequenceInformation from the database
- Do you need a database transaction for reading data?
- Java / Hibernate – Write operations are not allowed in read-only mode
- Manually call Spring Annotation Validation
- The onFlushDirty Hibernate Interceptor method is never called
- spring data jpa @query and pageable
- compatibility of spring 4.0.0 with hibernate 4.30 [duplicate]
- Access Spring beans from a servlet in JBoss
- Why HibernateTemplate isn’t recommended? [duplicate]
- HibernateException: Couldn’t obtain transaction-synchronized Session for current thread
- Error creating bean with name ‘entityManagerFactory
- Return a stream with Spring MVC’s ResponseEntity
- java.lang.IllegalStateException: No transactional EntityManager available
- hibernate two tables per one entity
- Array with UserType in Hibernate and PostgreSQL –> MappingException
- FetchMode join makes no difference for ManyToMany relations in spring JPA repositories
- Spring – Modifying headers for every request after processing (in postHandle)
- Autowired Repository is Null in Custom Constraint Validator
- How to find distinct rows with field in list using JPA and Spring?
- Logging response body (HTML) from HttpServletResponse using Spring MVC HandlerInterceptorAdapter