samedi 11 avril 2015

Multiple temp table queries in NamedParameterJdbcTemplate

I have this set of MySQL queries I need to execute using a NamedParameterJdbcTemplate:



CREATE TEMPORARY TABLE t1 SELECT * FROM tree;
CREATE TEMPORARY TABLE t2 SELECT * FROM tree;
SELECT level_1 FROM t1
UNION
SELECT level_2 FROM t2;


The multiple temp tables is (in case someone's wondering) a trick to work around MySQL not letting you use the same table twice in a query.


Now there are two problems I need a solution for:



  1. Running multiple statements, including both DML & DDL

  2. Running temp table queries; NamedParameterJdbcTemplate gives you a different connection for every call, hence you will lose all temp tables between calls.


TIA.


Aucun commentaire:

Enregistrer un commentaire