[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-4579) query.setMaxResults causes com.mysql.jdbc.exceptions.MySQLSyntaxErrorException

Phil Russell (JIRA) noreply at atlassian.com
Wed Nov 18 22:05:08 EST 2009


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-4579?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=34664#action_34664 ] 

Phil Russell commented on HHH-4579:
-----------------------------------

Identified as not a bug. Was using the wrong dialect for Mysql 5. Dialect should have been org.hibernate.dialect.MySQL5Dialect and was using org.hibernate.dialect.MySQLDialect

 

> query.setMaxResults causes com.mysql.jdbc.exceptions.MySQLSyntaxErrorException
> ------------------------------------------------------------------------------
>
>                 Key: HHH-4579
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4579
>             Project: Hibernate Core
>          Issue Type: Bug
>    Affects Versions: 3.3.1
>         Environment: MySql 5.1.37 hibernate-entitymanager-3.3.1.ga
>            Reporter: Phil Russell
>
> Can't setMaximumResults() on a query  - 
> e.g.
> public List<Hotel> findHotels() {
> 	int maxRecords = 10;
> 	int startPosition = 0;
> 	Query query = em.createQuery("select h from Hotel h where h.name = 'W Hotel'");
> 	query.setMaxResults(maxRecords); // if this line is removed, no error occurs
> 	query.setFirstResult(startPosition);
> 	List<Hotel> hotelList = query.getResultList();
> 	return hotelList;
> }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list