I need to create views from hql queries, or use them as inline views for larger sql queries. Hibernate doesn't support this, but a dirty hack comes to my mind. Hibernate somehow generates its sql, prepares the statements, sets parameters and sends the query to the database. If I could trick hibernate into giving me the generated sql and the paramters map, I could manipulate the sql (prepend "CREATE VIEW" etc), set the parameters from the map, and do the rest of the work directly.
This method could be equally useful with HQL and criteria queries because it would take over after SQL is generated.
Any ideas how I could do this?
|