This one time, at band camp, Wlid Yemah said:
WY>I have the following database configuration file
WY>containing one jdo mapping file 'demo-jdo1.xml':
WY>
WY><database name="care4u" engine="sapdb">
WY> <driver
WY>class-name="com.sap.dbtech.jdbc.DriverSapDB"
WY>url="jdbc:sapdb://pclab/telecare">
WY> <param name="user" value="telecare" />
WY> <param name="password" value="telecare" />
WY> </driver>
WY> <mapping href="/home/Software/demo-jdo1.xml" />
WY></database>
WY>
WY>My program starts and loads succesfully this file and
WY>everything goes as expected. During runtime (i.e.,
WY>without having to stop my program and restart it
WY>again), I want to include another mapping file, so I
WY>make my program load the configuration file which now
WY>looks like:
WY>
WY><database name="care4u" engine="sapdb">
WY> <driver
WY>class-name="com.sap.dbtech.jdbc.DriverSapDB"
WY>url="jdbc:sapdb://pclab/telecare">
WY> <param name="user" value="telecare" />
WY> <param name="password" value="telecare" />
WY> </driver>
WY> <mapping href="/home/Software/demo-jdo1.xml" />
WY> <mapping href="/home/Software/demo-jdo2.xml" />
WY></database>
WY>
WY>The file is loaded succesfully (at least it looks like
WY>it) however when I query on a class that is mapped in
WY>'demo-jdo2.xml' I get an exception:
WY>
WY>org.telecare.core.exception.JdoCastorException:
WY>org.exolab.castor.jdo.ClassNotPersistenceCapableException:
WY>The class demo.Address is not persistence capable: no
WY>mapping was defined for the class
WY>
WY>Class 'demo.Address' is well mapped in 'demo-jdo2.xml'
WY>but it seems that this mapping file has not been
WY>really loaded, and only the mappings defined in
WY>'demo-jdo1.xml' (which is probably cached in memory)
WY>is (re)used during my query. So how to force Castor to
WY>reload a database configuration file which has changed
WY>(in my case by adding another mapping file)? Any help
WY>would be greatly appreciated.
Wy,
I can think of two ways to get this occur:
1) Try calling Database.close() and then reaquire the connection
again via JDO.getDatabase()
2) Configure multiple <database> elements in the database
description, each containing a unique name so that they can
be loaded independent of one another
I'm not sure that suggestion number one will work and I don't have
the time to test it at the moment. I do know that suggestion number
two above will work for sure. Here is a quick example of how you
might achieve this:
<databases>
<database name="care4u1" engine="sapdb">
<driver class-name="com.sap.dbtech.jdbc.DriverSapDB"
url="jdbc:sapdb://pclab/telecare">
<param name="user" value="telecare" />
<param name="password" value="telecare" />
</driver>
<mapping href="/home/Software/demo-jdo1.xml" />
</database>
<database name="care4u2" engine="sapdb">
<driver class-name="com.sap.dbtech.jdbc.DriverSapDB"
url="jdbc:sapdb://pclab/telecare">
<param name="user" value="telecare" />
<param name="password" value="telecare" />
</driver>
<mapping href="/home/Software/demo-jdo1.xml" />
<mapping href="/home/Software/demo-jdo2.xml" />
</database>
</databases>
Notice the unique names on each <database> element. This will allow
you to load each one independent of the other via the use of
JDO.setDatabaseName() method.
Bruce
--
perl -e 'print unpack("u30","<0G)[EMAIL PROTECTED]&5R\"F9E<G)E=\$\!F<FEI+F-O;0\`\`");'
The Castor Project
http://www.castor.org/
Apache Geronimo
http://incubator.apache.org/projects/geronimo.html
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev