-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Can not issue data manipulation statements with executeQuery
PostPosted: Wed Aug 12, 2009 11:52 am 
Newbie

Joined: Wed Aug 12, 2009 11:49 am
Posts: 6
Note: I use Hibernate3 and MySql5.1 InnoDb.

I can run sql statement on command line successfully, but once I put these sql statements in Hibernate Mapping file, always gave me this error message.

Why cannot I use temporary table?

Caused by: org.hibernate.exception.GenericJDBCException: could not execute query
... 55 more
Caused by: java.sql.SQLException: Can not issue data manipulation statements with executeQuery().

the following is my sql statement:
CREATE TEMPORARY TABLE access_group_change_list
select distinct modification_timestamp, modified_by
from LOYALTY.access_group_history
where client_id = :clientId
and ( db_action in ('I', 'D')
or modification_timestamp in
(select max(modification_timestamp)
from LOYALTY.access_group_history
where client_id = :clientId)
)
;

CREATE TEMPORARY TABLE access_group_list
select access_group_id
from LOYALTY.access_group
where client_id = :clientId
;

CREATE TEMPORARY TABLE access_group_object_change_list
select modification_timestamp,
modified_by
from LOYALTY.v_organisation_object_group_history
where top_id = :clientId
order by modification_timestamp desc
limit 1
;

create temporary table agi_1 select access_group_id from access_group_list;
create temporary table agi_2 select access_group_id from access_group_list;
create temporary table agi_3 select access_group_id from access_group_list;

CREATE TEMPORARY TABLE other_latest_change_list
select modification_timestamp, modified_by
from access_group_object_change_list
union
select distinct modification_timestamp, modified_by
from LOYALTY.access_group_client_rhistory
where modification_timestamp in (
select max(modification_timestamp)
from LOYALTY.access_group_client_rhistory
where access_group_id in (select access_group_id from agi_1)
)
union
select distinct modification_timestamp, modified_by
from LOYALTY.access_group_members_rhistory
where modification_timestamp in (
select max(modification_timestamp)
from LOYALTY.access_group_members_rhistory
where access_group_id in (select access_group_id from agi_2)
)
union
select distinct modification_timestamp, modified_by
from LOYALTY.access_group_visibility_rhistory
where modification_timestamp in (
select max(modification_timestamp)
from LOYALTY.access_group_visibility_rhistory
where viewer_access_group_id in (select access_group_id from agi_3)
)
;

CREATE TEMPORARY TABLE all_change_list
(select distinct modification_timestamp, modified_by
from other_latest_change_list
order by modification_timestamp
limit 1)
union
(select modification_timestamp, modified_by
from access_group_change_list)
;

select distinct modification_timestamp, modified_by
from all_change_list
order by modification_timestamp desc


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.