I cannot able to create temporary table using hibernate here is my code
getSession().beginTransaction();
String queryString1 = "CREATE TEMPORARY TABLE sage_temp_table(CRMID VARCHAR(60),POPAmountPaid DECIMAL(14,2)) ";
getSession().createSQLQuery(queryString1).executeUpdate();
getSession().flush();
String queryString2 = "INSERT INTO sage_temp_table(CRMID,POPAmountPaid) SELECT CRMID,POPAmountPaid FROM sage_payments WHERE sage_payments.`CRMID` REGEXP \"^[0-9]+$\" AND"
+ " sage_payments.POPPaidDate NOT LIKE \"%0000-00-00 00%\" AND sage_payments.POPPaidDate IS NOT NULL AND sage_payments.POPAmountPaid IS NOT NULL";
getSession().createSQLQuery(queryString2).executeUpdate();
getSession().beginTransaction().commit();
Here in logs it shows commands are running but when i select content from table it says table sage_temp_table does not exist thus is not created and does not give any error.Here are the logs
04:00:04,549 INFO [STDOUT] Hibernate: CREATE TEMPORARY TABLE sage_temp_table(CRMID VARCHAR(60),POPAmountPaid DECIMAL(14,2))
04:00:17,463 INFO [STDOUT] Hibernate: INSERT INTO sage_temp_table(CRMID,POPAmountPaid) SELECT CRMID,POPAmountPaid FROM sage_payments WHERE sage_payments.`CRMID` REGEXP "^[0-9]+$" AND sage_payments.POPPaidDate NOT LIKE "%0000-00-00 00%" AND sage_payments.POPPaidDate IS NOT NULL AND sage_payments.POPAmountPaid IS NOT NULL
Here one more case when i remove TEMPORARY from queryString1 table gets created and insertion also takes place. Please tell me what is wrong in it?