1つの関数で以下のクエリを実行していますが、「SQLGrammarException:ネイティブバルク操作クエリエラーを実行できませんでした」という例外が発生します。
誰かが私にそれの解決策を教えてもらえますか?HQLは使いたくない。
query = session.createSQLQuery("CREATE TEMPORARY TABLE temp select `"+xAxis+"`, sum(value) as length from (select * from "+xAxis+"Table union select `"+xAxis+"`, sum(cycles) as value from "+Constants.TABLE_NAME+" where datestamp >= '"+startDate+"' and datestamp < '"+endDate+"' and `"+groupBy+"` = '"+groupByBar1+"' and `"+xAxis+"` = 'Uptime' group by `"+xAxis+"`) as t group by `"+xAxis+"` "+fixOrderString+" ;CREATE TEMPORARY TABLE test select `"+xAxis+"`, sum(value) as length from (select * from "+xAxis+"Table union select `"+xAxis+"`, sum(cycles) as value from "+Constants.TABLE_NAME+" where datestamp >= '"+startDate+"' and datestamp < '"+endDate+"' and `"+xAxis+"` = 'Uptime' group by `"+xAxis+"`) as t group by `"+xAxis+"` "+fixOrderString+" ;alter table test add column `"+groupByBar1+"` INTEGER ;");
query.executeUpdate();
query = session.createSQLQuery("update test,temp set `"+groupByBar1+"` = temp.length where test.`"+xAxis+"` = temp.`"+xAxis+"` ; drop table temp ; CREATE TEMPORARY TABLE temp select `"+xAxis+"`, sum(value) as length from (select * from "+xAxis+"Table union select `"+xAxis+"`, sum(cycles) as value from "+Constants.TABLE_NAME+" where datestamp >= '"+startDate+"' and datestamp < '"+endDate+"' and `"+groupBy+"` = '"+groupByBar2+"' and `"+xAxis+"` = 'Uptime' group by `"+xAxis+"`) as t group by `"+xAxis+"` "+fixOrderString+" ;alter table test add column `"+groupByBar2+"` INTEGER ; ");
query.executeUpdate();
query = session.createSQLQuery("update test,temp set `"+groupByBar2+"` = temp.length where test.`"+xAxis+"` = temp.`"+xAxis+"` ; drop table temp ; CREATE TEMPORARY TABLE temp select `"+xAxis+"`, sum(value) as length from (select * from "+xAxis+"Table union select `"+xAxis+"`, sum(cycles) as value from "+Constants.TABLE_NAME+" where datestamp >= '"+startDate+"' and datestamp < '"+endDate+"' and `"+groupBy+"` = '"+groupByBar3+"' and `"+xAxis+"` = 'Uptime' group by `"+xAxis+"`) as t group by `"+xAxis+"` "+fixOrderString+" ;alter table test add column `"+groupByBar3+"` INTEGER ;");
query.executeUpdate();
query = session.createSQLQuery("update test,temp set `"+groupByBar3+"` = temp.length where test.`"+xAxis+"` = temp.`"+xAxis+"` ; drop table temp ; CREATE TEMPORARY TABLE temp select `"+xAxis+"`, sum(value) as length from (select * from "+xAxis+"Table union select `"+xAxis+"`, sum(cycles) as value from "+Constants.TABLE_NAME+" where datestamp >= '"+startDate+"' and datestamp < '"+endDate+"' and `"+groupBy+"` = '"+groupByBar4+"' and `"+xAxis+"` = 'Uptime' group by `"+xAxis+"`) as t group by `"+xAxis+"` "+fixOrderString+" ;alter table test add column `"+groupByBar4+"` INTEGER ;");
query.executeUpdate();
query = session.createSQLQuery("update test,temp set `"+groupByBar4+"` = temp.length where test.`"+xAxis+"` = temp.`"+xAxis+"` ; drop table temp ; CREATE TEMPORARY TABLE temp select `"+xAxis+"`, sum(value) as length from (select * from "+xAxis+"Table union select `"+xAxis+"`, sum(cycles) as value from "+Constants.TABLE_NAME+" where datestamp >= '"+startDate+"' and datestamp < '"+endDate+"' and `"+groupBy+"` = `"+Constants.OTHERS+"' and `"+xAxis+"` = 'Uptime' group by `"+xAxis+"`) as t group by `"+xAxis+"` "+fixOrderString+" ;alter table test add column `"+Constants.OTHERS+"' INTEGER ;");
query.executeUpdate();
query = session.createSQLQuery("update test,temp set `"+Constants.OTHERS+"` = temp.length where test.`"+xAxis+"` = temp.`"+xAxis+"`;");
query.executeUpdate();
query = session.createSQLQuery("select * from test "+fixOrderString+" ;");