[jboss-user] [EJB 3.0] - Re: How to get the size of a Lazy load relation

icordoba do-not-reply at jboss.com
Mon Sep 17 11:19:40 EDT 2007


Thanks a lot for your reply.
I am trying this both as a NamedQuery or as a direct query and I am getting the following exception:

2007-09-17 17:12:05,036 DEBUG [org.hibernate.SQL] select count(.) as col_0_0_ from Role role0_, User_Role users1_, User user2_ where role0_.pkey=users1_.roles_pkey and users1_.users_pkey=user2_.pkey and role0_.pkey=?
  | 2007-09-17 17:12:05,038 DEBUG [org.hibernate.jdbc.AbstractBatcher] about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
  | 2007-09-17 17:12:05,038 DEBUG [org.hibernate.jdbc.ConnectionManager] aggressively releasing JDBC connection
  | 2007-09-17 17:12:05,038 DEBUG [org.hibernate.jdbc.ConnectionManager] releasing JDBC connection [ (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)]
  | 2007-09-17 17:12:05,039 DEBUG [org.hibernate.util.JDBCExceptionReporter] could not execute query [select count(.) as col_0_0_ from Role role0_, User_Role users1_, User user2_ where role0_.pkey=users1_.roles_pkey and users1_.users_pkey=user2_.pkey and role0_.pkey=?]
  | com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') as col_0_0_ from Role role0_, User_Role users1_, User user2_ where role0_.pkey' at line 1
  | 

The compiled HQL is the folling (and when using a named query it is compiled without errors):

select count(r.users) from com.servengine.user.Role r WHERE r.pkey = :pkey

Thanks for any ideas,
Ignacio

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4085107#4085107

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4085107



More information about the jboss-user mailing list