Great! Glad it works, I will try create a new bug on this to have a
mention of this in docs, and also to clean up the Mapping errors and
such.


On Tue, 1 Feb 2005 17:04:34 +0100, Aziz Hammadi <[EMAIL PROTECTED]> wrote:
> 
> Hi Nick
> you would not believe it but re-aaranging the mapping was the
> solution! It works now perfectly. By the way I wanted to load an
> object into the db. It wasn't a select operation.
> Give a look to this piece of code in (MappingLoader.java:422).:
> if ( depend == null )
>                     throw new MappingException( "Depends not found" +
>                                                 clsMap.getDepends() +
> " " + javaClass.getName() );
>                 if ( depend == NoDescriptor )
>                     throw new MappingException( "Depends not found" +
>                                                 clsMap.getDepends() +
> " " + javaClass.getName() );
>             } catch ( ClassNotFoundException except )
> 
> The error description is the same but the sources are quite different.
> One little thing more:
> can you add a space char after the string found? :-)
> 
> Well here is the complete error message:
> 
> log4j:WARN No appenders could be found for logger
> (org.exolab.castor.jdo.engine.JDOConfLoader).
> log4j:WARN Please initialize the log4j system properly.
> org.exolab.castor.jdo.DatabaseNotFoundException: Nested error:
> org.exolab.castor.mapping.MappingException: Depends not
> [EMAIL PROTECTED] EepromCell:
> Nested error: org.exolab.castor.mapping.MappingException: Depends not
> [EMAIL PROTECTED] EepromCell
>         at org.exolab.castor.jdo.JDO.getDatabase(JDO.java:567)
>         at com.nokia.dump2db.mapper.DbMapper.mappToDb(DbMapper.java:97)
>         at com.nokia.dump2db.main.MainApp.main(MainApp.java:54)
> Caused by: org.exolab.castor.mapping.MappingException: Nested error:
> org.exolab.castor.mapping.MappingException: Depends not
> [EMAIL PROTECTED] EepromCell
>         at org.exolab.castor.mapping.Mapping.getResolver(Mapping.java:295)
>         at 
> org.exolab.castor.jdo.engine.DatabaseRegistry.initFromDriver(DatabaseRegistry.java:469)
>         at 
> org.exolab.castor.jdo.engine.DatabaseRegistry.loadDatabase(DatabaseRegistry.java:324)
>         at 
> org.exolab.castor.jdo.engine.DatabaseRegistry.loadDatabase(DatabaseRegistry.java:254)
>         at org.exolab.castor.jdo.JDO.getDatabase(JDO.java:565)
>         ... 2 more
> Caused by: org.exolab.castor.mapping.MappingException: Depends not
> [EMAIL PROTECTED] EepromCell
>         at 
> org.exolab.castor.mapping.loader.MappingLoader.createDescriptor(MappingLoader.java:422)
>         at 
> org.exolab.castor.jdo.engine.JDOMappingLoader.createDescriptor(JDOMappingLoader.java:135)
>         at 
> org.exolab.castor.mapping.loader.MappingLoader.loadMapping(MappingLoader.java:289)
>         at 
> org.exolab.castor.jdo.engine.JDOMappingLoader.loadMapping(JDOMappingLoader.java:324)
>         at org.exolab.castor.mapping.Mapping.getResolver(Mapping.java:292)
>         at 
> org.exolab.castor.jdo.engine.DatabaseRegistry.initFromDriver(DatabaseRegistry.java:469)
>         at 
> org.exolab.castor.jdo.engine.DatabaseRegistry.loadDatabase(DatabaseRegistry.java:324)
>         at 
> org.exolab.castor.jdo.engine.DatabaseRegistry.loadDatabase(DatabaseRegistry.java:254)
>         at org.exolab.castor.jdo.JDO.getDatabase(JDO.java:565)
>         at com.nokia.dump2db.mapper.DbMapper.mappToDb(DbMapper.java:97)
>         at com.nokia.dump2db.main.MainApp.main(MainApp.java:54)
> Caused by: org.exolab.castor.mapping.MappingException: Depends not
> [EMAIL PROTECTED] EepromCell
>         at 
> org.exolab.castor.mapping.loader.MappingLoader.createDescriptor(MappingLoader.java:422)
>         at 
> org.exolab.castor.jdo.engine.JDOMappingLoader.createDescriptor(JDOMappingLoader.java:135)
>         at 
> org.exolab.castor.mapping.loader.MappingLoader.loadMapping(MappingLoader.java:289)
>         at 
> org.exolab.castor.jdo.engine.JDOMappingLoader.loadMapping(JDOMappingLoader.java:324)
>         at org.exolab.castor.mapping.Mapping.getResolver(Mapping.java:292)
>         at 
> org.exolab.castor.jdo.engine.DatabaseRegistry.initFromDriver(DatabaseRegistry.java:469)
>         at 
> org.exolab.castor.jdo.engine.DatabaseRegistry.loadDatabase(DatabaseRegistry.java:324)
>         at 
> org.exolab.castor.jdo.engine.DatabaseRegistry.loadDatabase(DatabaseRegistry.java:254)
>         at org.exolab.castor.jdo.JDO.getDatabase(JDO.java:565)
>         at com.nokia.dump2db.mapper.DbMapper.mappToDb(DbMapper.java:97)
>         at com.nokia.dump2db.main.MainApp.main(MainApp.java:54)
> Exception in thread "main" java.lang.NullPointerException
>         at com.nokia.dump2db.mapper.DbMapper.mappToDb(DbMapper.java:108)
>         at com.nokia.dump2db.main.MainApp.main(MainApp.java:54)
> On Tue, 1 Feb 2005 10:42:05 -0500, Nick Stuart <[EMAIL PROTECTED]> wrote:
> >
> > You are right, that is a bad error being thrown. But, my question is,
> > are you trying to load the EepromCell directly? Are you trying to do
> > something like:
> >
> > db.load(EepromCell.class, <some-id>)
> >
> > Because that isn't going to work. The depends attribute brings with
> > the fact that this object will never standalone, and hence, never be
> > loaded by itself.
> >
> > But assuming you are not doing this. Try re-arranging the mappings so
> > that the parents are first, then the children (dont believe this
> > matters, but its worth a shot). I've always set my mappings up this
> > way and have ever had a problem. Like I said, everything appears to be
> > setup correctly.
> >
> > Can you paste the whole stacktrace so we can get line numbers. Would
> > at least like to clean up the error report for a bit better
> > description.  :)
> >
> > -Nick
> >
> >
> > On Tue, 1 Feb 2005 16:10:12 +0100, Aziz Hammadi <[EMAIL PROTECTED]> wrote:
> > >
> > > Here is the error message I get:
> > >
> > > org.exolab.castor.jdo.DatabaseNotFoundException: Nested error:
> > > org.exolab.castor.mapping.MappingException: Depends not
> > > [EMAIL PROTECTED] EepromCell:
> > > Nested error: org.exolab.castor.mapping.MappingException: Depends not
> > > [EMAIL PROTECTED] EepromCell
> > >
> > > The exception is thrown while  trying to get dependent classes. I
> > > followed it into the castor source code. It is badly described through
> > > a DatabaseNotFoundException. It is irritating.
> > > The connection to the database does exist. As I mentioned eralier
> > > mapping just one dependency level works.
> > >
> > >
> > > On Tue, 1 Feb 2005 09:50:26 -0500, Nick Stuart <[EMAIL PROTECTED]> wrote:
> > > >
> > > > That looks as though its setup correctly, so what is exactly is the
> > > > error that comes up? Or the functionality that isn't working? Is it
> > > > generating a stacktrace or is it just not behaving as expected? Again,
> > > > this setup should work, it might just depend on what you are looking
> > > > for it to do.
> > > >
> > > > -Nick
> > > >
> > > >
> > > > On Tue, 1 Feb 2005 15:33:00 +0100, Aziz Hammadi <[EMAIL PROTECTED]> 
> > > > wrote:
> > > > >
> > > > > Sorry Nick! that was a copy-and-paste mistake. The cell depends on
> > > > > Sector but it does not work.  Here is my real xml file based on the
> > > > > folowing model:
> > > > >
> > > > >  Eeprom 1--------------------* EepromBlock 1--------------------*
> > > > >
> > > > >         <class name="EepromCell" identity="id" 
> > > > > key-generator="IDENTITY"
> > > > > depends="EepromBlock">
> > > > >                 <map-to table="eepromcell"/>
> > > > >                 <field name="id" type="integer">
> > > > >                         <sql name="id" type="integer"/>
> > > > >                 </field>
> > > > >                 <field name="name" type="string" required="true" 
> > > > > transient="false"
> > > > > direct="false">
> > > > >                         <sql name="name" type="char"/>
> > > > >                 </field>
> > > > >                 <field name="value" type="string" required="true" 
> > > > > transient="false"
> > > > > direct="false">
> > > > >                         <sql name="value" type="char"/>
> > > > >                 </field>
> > > > > <!-- reference to the parent -->
> > > > >                         <field name="eepromBlock" type="EepromBlock" 
> > > > > required="true"
> > > > > transient="false" direct="false">
> > > > >                         <sql name="EepromBlock_Id"/>
> > > > >                 </field>
> > > > >         </class>
> > > > >
> > > > >         <class name="EepromBlock" identity="id" 
> > > > > key-generator="IDENTITY"
> > > > > depends="Eeprom">
> > > > >                 <map-to table="eepromblock"/>
> > > > >                 <field name="id" type="integer">
> > > > >                         <sql name="id" type="integer"/>
> > > > >                 </field>
> > > > >                 <field name="number" type="integer">
> > > > >                         <sql name="number" type="integer"/>
> > > > >                 </field>
> > > > >                 <!-- reference to the parent -->
> > > > >                 <field name="eeprom" type="Eeprom" required="true" 
> > > > > transient="false"
> > > > > direct="false">
> > > > >                         <sql name="Eeprom_Id"/>
> > > > >                 </field>
> > > > >                 <!-- reference to the children-->
> > > > >                                 <field name="eepromCell" 
> > > > > type="EepromCell" collection="array"
> > > > > required="true">
> > > > >                         <sql many-key="EepromBlock_id"/>
> > > > >                 </field>
> > > > >         </class>
> > > > >         <class name="Eeprom" identity="id" key-generator="IDENTITY">
> > > > >                 <map-to table="eeprom"/>
> > > > >                 <field name="id" type="integer">
> > > > >                         <sql name="id" type="integer"/>
> > > > >                 </field>
> > > > > <!-- reference to the children-->
> > > > >                                                 <field 
> > > > > name="eepromBlock" type="EepromBlock" collection="array"
> > > > > required="true">
> > > > >                         <sql many-key="Eeprom_id"/>
> > > > >                 </field>
> > > > >         </class>
> > > > >
> > > > >
> > > > > On Tue, 1 Feb 2005 08:47:32 -0500, Nick Stuart <[EMAIL PROTECTED]> 
> > > > > wrote:
> > > > > >
> > > > > > Shouldnt the cell contain its parent sector, and not the hard disk? 
> > > > > > So
> > > > > > you would have something like:
> > > > > > <class name="Cell" depends="Sector">
> > > > > >     <field name="sector type="Sector">
> > > > > >         <sql name="sector_Id"/>
> > > > > >     </field>
> > > > > > </class>
> > > > > >
> > > > > > This would make more sense in the hierarchy to have it setup this 
> > > > > > way.
> > > > > > I've been able to use several levels of dependencies with out any
> > > > > > issues. At least 3 levels deep, and more. I always have a reference
> > > > > > from the parent (HardDisk) to the children (Sectors) and the other 
> > > > > > way
> > > > > > as well (from the children back to the parent). You didn't supply 
> > > > > > the
> > > > > > full mapping so I dont know if you have this or not.
> > > > > >
> > > > > > -Nick
> > > > > >
> > > > > > Be something
> > > > > > On Tue, 1 Feb 2005 12:43:59 +0100, Aziz Hammadi <[EMAIL PROTECTED]> 
> > > > > > wrote:
> > > > > > >
> > > > > > > I have the following model:
> > > > > > >
> > > > > > >       HardDisk 1 ------------* Sector 1 ------------- * Cell
> > > > > > >
> > > > > > > 1) mapping
> > > > > > >            HardDisk 1 --------------- * Sector
> > > > > > > using this :
> > > > > > >
> > > > > > > <class name="Sector" depends="HardDisk">
> > > > > > > <field name="hardDisk" type="HardDisk">
> > > > > > >         <sql name="hardDisk_Id"/>
> > > > > > >         </field>
> > > > > > > </class>
> > > > > > >
> > > > > > > <class name="Cell" depends="Sector">
> > > > > > > <field name="hardDisk" type="HardDisk">
> > > > > > >         <sql name="sector_Id"/>
> > > > > > >         </field>
> > > > > > > </class>
> > > > > > >
> > > > > > > works.
> > > > > > >
> > > > > > > 2)   mapping
> > > > > > >            Sector 1 --------------- * Cell
> > > > > > > works using a similar mapping.
> > > > > > >
> > > > > > > 3) While trying to mapp
> > > > > > >       HardDisk 1 ------------* Sector 1 ------------- * Cell
> > > > > > > all together I get this exception:
> > > > > > >
> > > > > > > org.exolab.castor.mapping.MappingException: Depends not
> > > > > > > [EMAIL PROTECTED] Cell
> > > > > > >
> > > > > > > The mapping file looks like this (simple):
> > > > > > >
> > > > > > > <class name="HardDisk" >
> > > > > > > </class>
> > > > > > >
> > > > > > > <class name="Sector" depends="HardDisk">
> > > > > > > <field name="hardDisk" type="HardDisk">
> > > > > > >         <sql name="hardDisk_Id"/>
> > > > > > >         </field>
> > > > > > > </class>
> > > > > > >
> > > > > > > <class name="Cell" depends="Sector">
> > > > > > > <field name="hardDisk" type="HardDisk">
> > > > > > >         <sql name="sector_Id"/>
> > > > > > >         </field>
> > > > > > > </class>
> > > > > > >
> > > > > > > Does castor provide dependency recursion? I tryed to look at some
> > > > > > > mapping files of  some open source code project using castor but 
> > > > > > > none
> > > > > > > of them uses such a hierarchical structure
> > > > > > > despite of the fact that this is a very used model!
> > > > > > > I use castor-0.9.6-RC3.jar
> > > > > > >
> > > > > > > cheers!
> > > > > > >
> > > > > > > -----------------------------------------------------------
> > > > > > > If you wish to unsubscribe from this mailing, send mail to
> > > > > > > [EMAIL PROTECTED] with a subject of:
> > > > > > >         unsubscribe castor-user
> > > > > > >
> > > > > >
> > > > > > -----------------------------------------------------------
> > > > > > If you wish to unsubscribe from this mailing, send mail to
> > > > > > [EMAIL PROTECTED] with a subject of:
> > > > > >         unsubscribe castor-user
> > > > > >
> > > > >
> > > > >
> > > > > -----------------------------------------------------------
> > > > > If you wish to unsubscribe from this mailing, send mail to
> > > > > [EMAIL PROTECTED] with a subject of:
> > > > >         unsubscribe castor-user
> > > > >
> > > >
> > > > -----------------------------------------------------------
> > > > If you wish to unsubscribe from this mailing, send mail to
> > > > [EMAIL PROTECTED] with a subject of:
> > > >         unsubscribe castor-user
> > > >
> > >
> > > -----------------------------------------------------------
> > > If you wish to unsubscribe from this mailing, send mail to
> > > [EMAIL PROTECTED] with a subject of:
> > >         unsubscribe castor-user
> > >
> > 
> > -----------------------------------------------------------
> > If you wish to unsubscribe from this mailing, send mail to
> > [EMAIL PROTECTED] with a subject of:
> >         unsubscribe castor-user
> >
> 
> -----------------------------------------------------------
> If you wish to unsubscribe from this mailing, send mail to
> [EMAIL PROTECTED] with a subject of:
>         unsubscribe castor-user
>



----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-user

Reply via email to