Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-21-2010, 03:45 PM
Member
 
Join Date: Jan 2010
Posts: 2
Rep Power: 0
richteri is on a distinguished road
Question Spring, iBatis and multiple Oracle tablespaces
Hi there!
I have a problem with managing multiple Oracle tablespaces (with Spring and iBatis). I have one administration tablespace that stores information about other tablespaces (like their name). Right after a user logs in, selects a tablespace to work with. I store this information in session. The user can only work with one tablespace in a time. These "work-tablespaces" share a common structure, so I try to hide the schema name prefix from my DAO classes.
Earlier I tried to use $substitution$ syntax of iBatis, but I didn't like the HashMap I had to use as parameter in every query. Now I'm trying to issue an ALTER SESSION SET CURRENT_SCHEMA command, but I'm afraid of its impact on caching, and I couldn't find an elegant solution to run this command before every query.
I read something about SqlMapClientCallback interface, but I don't know how to wire its implementation to my SqlMapClientTemplate and wether the doInSqlMapClient method of SqlMapClientCallbackImpl would run before or after the queries.
Could you point me to the right direction how to manage these tablespaces?
Thanks in advance.
Istvan
Bookmark Post in Technorati
Reply With Quote
  #2 (permalink)  
Old 01-26-2010, 09:26 AM
Member
 
Join Date: Jan 2010
Posts: 2
Rep Power: 0
richteri is on a distinguished road
Arrow
UPDATE:
I managed to implement a simple solution, thanks to the flexibility of iBatis:

Tables:
ADMIN.PROJECT(id, oracle_ts_name, etc.)
ADMIN.DATASET(id, project_id, name, description)
$oracle_ts_name$.DATASET_STRUCTURE(id, dataset_id, variable_name, variable_datatype, etc.)
$oracle_ts_name$.DS_001(cols are defined in DATASET_STRUCTURE)
...
$oracle_ts_name$.DS_XYZ(cols are defined in DATASET_STRUCTURE)


I simply have to provide tablespace property to the nested model objects:
--------------------------------------
selectDatasetsByProjectId:
Code:
        
SELECT 
       	d.id,
       	p.oracle_ts_name oracleTsName, 
       	d.name,
       	d.description 
FROM 
       	${admin.tablespace}.dataset d
       	INNER JOIN ${admin.tablespace}.project p ON (d.project_id=p.id) 
WHERE project_id = #value#
ORDER BY d.id

And then the $substitution$ syntax can be used:
--------------------------------------
selectDatasetStructureById
Code:
SELECT * FROM $oracleTsName$.DATASET_STRUCTURE 
WHERE dataset_id = #datasetId#
Everything works fine (including caching), but my next problem will be managing the DS_XYZ tables through Spring powered forms.

Any suggestion? (I can't change the DB structure )

Thanks
Bookmark Post in Technorati
Reply With Quote
Reply

Bookmarks

Tags
doinsqlmapclient, ibatis, multiple schema, oracle, spring

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
insert statement return problem in ibatis dheerajsea123 Database 0 06-20-2009 02:01 PM
innoDB + ibatis vinoopraj Advanced Java 0 05-19-2009 10:57 AM
Hibernate vs iBATIS priyanka.dandekar Web Frameworks 3 11-11-2008 11:59 AM
why oracle index can't work correctly in oracle? wwwlife Database 0 08-27-2008 10:27 AM
Tomcat iBatis log4j Tokajac Web Frameworks 0 07-17-2008 04:02 PM


All times are GMT +2. The time now is 03:12 AM.



VBulletin, Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2009, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org