[Opensource] pb retrieving BDObjLimit with DB without setup tables
Thierry Clement
Thierry.Clement at cetim.fr
Wed Mar 5 10:01:02 PST 2003
I found out that DBObject thows an exception which I think it shouldn't,
in the case of using the "DBOtherMap" feature and no Setup Values,
like set in this expresso-config file:
<context name="default">
<description>default context - Expresso data</description>
<jdbc driver="org.gjt.mm.mysql.Driver" ... cache="y"/>
...
<context name="annuaire">
<description>Oracle context - pure data</description>
<hasSetupTables>false</hasSetupTables>
<jdbc driver=oracle.jdbc.driver.OracleDriver" ...
cache="y"/>
...
</context name>
My schema being set thru a class extending
com.jcorporate.expresso.core.dbobj.Schema with declarations in constructor
such as:
addDBObject( "com.cetim.annuaire.dbobj.Hie_node", "annuaire"
);
[ Hie_node is the name of a table in my Oracle DB connected to context
"annuaire" and also the name of the corresponding DBObject]
When running the app and accessing Hie_node, JDBCExecutor tries to find a
table DBOBJLIMIT in the Oracle DB, which is in fact in the MySql DB
(default context) [ in a stack like IsCached -> getCacheSize() ->
setCacheSize() -> dbl.retrieve() ]
May be my configuration is wrong (tell me if it is the case), but - if not
- I found a solution to avoid that, in DBObject.java, around line 6185 -
the idea is to use "default" context in this case
[ from expresso 5-03 ]
if (dbl == null) {
dbl = new DBObjLimit();
// dbl.setDBName(getOriginalDBName()); // WHAT I
COMMENTED and replaced by the following lines
// change: "default" context has to be set in the case of
a DB without setup tables
ConfigContext oneContext = null;
String origDBName = getOriginalDBName();
try {
oneContext = ConfigManager.getContext(origDBName);
}
catch (ConfigurationException ignored) { }
if (oneContext != null && !(oneContext.hasSetupTables()))
{
dbl.setDBName("default");
}
else {
dbl.setDBName(origDBName);
}
// END CHANGE
dbl.setField("DBObjectName", this.myClassName);
Has anyone experienced the same pb. and is it a proper change ?
Thanks
Thierry Clement
CETIM - France
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.jcorporate.com/pipermail/opensource/attachments/20030305/b80730cc/attachment-0002.htm
More information about the Opensource
mailing list