Hello, Hibernate Gurus,
I'm having some headaches with execution of the JPA query stem from the createNativeQuery method of EntityManager object
I have this massive amount of data that I want to output to a file directly by using MySQL's
"select .. into outfile 'file name' ..."
(if I don't, it will have Java run out of heap space and I don't want to page thru the results)
The query works fine in the database console.
but if I tried to execute the JPA query with
1. executeUpdate : it returns an exception saying that executeUpdate can't be used for chulk query or sth
2. getSingleResult : it will have the SQL statement automatically appended with ' limit 2' that results in an SQL syntax error.
3. getResultList : this is the only one that has the query executed. But it returns a GenericJDBCException, which will terminate my function calling stacks. I've tried to catch the particular exception and simply return within the exception catching block, still it triggers the rollback of transaction in my EJB module.
database : MySQL 4.0.27
hibernate core : hibernate-3.2
hibernate-entitymanager-3.4.0.GA
can someone kindly show me how to elegantly handle this situations?
thank you so much for any helps and hints
|