[Opensource] pb retrieving BDObjLimit with DB without setup tables
Malcolm Wise
malcolm.wise at sde.eu.sony.com
Mon Mar 10 04:50:38 PST 2003
Hi Thierry,
I was getting the same problem on some of my DBObjects. After a little
investigation, I found that as well as setting up my DBObjects in
DBOtherMap, I was also calling setDataContext(). Removing the call to
setDataContext() stopped the exception being thrown. I think that
setDataContext() sets the originalDBKey field (returned by
getOriginalDBName()).
Maybe this is the same in your case. If so, you won't need to make any
changes to DBObject code.
Cheers
Malc
-----Original Message-----
From: opensource-admin at jcorporate.com
[mailto:opensource-admin at jcorporate.com]On Behalf Of Thierry Clement
Sent: 05 March 2003 18:01
To: opensource at jcorporate.com
Subject: [Opensource] pb retrieving BDObjLimit with DB without setup
tables
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
*************************************************************************
The information contained in this message or any of its
attachments may be privileged and confidential and intended
for the exclusive use of the addressee. If you are not the
addressee any disclosure, reproduction, distribution or other
dissemination or use of this communication is strictly prohibited
*************************************************************************
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.jcorporate.com/pipermail/opensource/attachments/20030310/5c73080b/attachment-0002.htm
More information about the Opensource
mailing list