Ok her it is...

    public Project loadProject (int projectNumber) throws
PersistenceException{
        Project prj;
        Database projectData = null;
        try{
            projectData = projects.getDatabase ();
            projectData.begin ();
            prj = (Project)projectData.load (Project.class, new Integer
(projectNumber));
            projectData.commit ();
        }catch(PersistenceException pe){
            if(logger.isDebugEnabled()){
                logger.debug("There was a problem loading the project.",
pe);
            }           
            throw pe;
        }finally{
            if(projectData != null){ closeDatabase (projectData); }
        }
        return prj;
    }

Of course there is more to the mapping files....

<class name="com.vort.ads.beans.Project" identity="id">
    <map-to table="prjinfo" />
    <field name="id" type="integer">
      <sql name="id" type="integer" />
    </field>
    <field name="systems"
type="com.vort.ads.vortechs.beans.VortechsDims" collection="vector">
        <sql many-key="projectNumber"/>
    </field>
    <field name="vortSentrys"
type="com.vort.ads.vortsentry.beans.VortSentryDims" collection="vector">
        <sql many-key="prjId"/>
    </field>
..
</class>

<class name="com.vort.ads.vortsentry.beans.VortSentryDims" identity="id"
key-generator="IDENTITY"> 
    <map-to table="prjvsdims"/>
    <field name="id" type="integer">
      <sql name="id" type="integer" />
    </field>
    <field name="project" type="com.vort.ads.beans.Project">
      <sql name="prjId" />
    </field>
    <field name="manuals"
type="com.vort.ads.vortsentry.beans.VortSentryManuals">
        <sql many-key="systemId" />
    </field>
    <field name="modelDims"
type="com.vort.ads.vortsentry.beans.VortSentryModelDims">
        <sql many-key="systemId"/>
    </field>
..
</class>

That's it, all there is to it. I'm just trying to load a project, which
in turns load a system, which then loads the model dims.

-------Original Message-----
--From: Bruce Snyder [mailto:[EMAIL PROTECTED] 
--Sent: Wednesday, July 14, 2004 11:43 AM
--To: [EMAIL PROTECTED]
--Subject: Re: [castor-dev] Get/set for booleans
--
--
--This one time, at band camp, Nick Stuart said:
--
--NS>The get/set methods make sense. But I'm not having any 
--luck with the 
--NS>boolean. Here's an example of what I'm doing...
--NS>
--NS>  <class name="com.vort.ads.vortsentry.beans.VortSentryModelDims"
--NS>        identity="id"
--NS>depends="com.vort.ads.vortsentry.beans.VortSentryDims"
--NS>key-generator="IDENTITY"> 
--NS>    .....
--NS>    <field name="combineBaseSlabRiser" type="boolean">
--NS>        <sql name="combineBaseSlabRiser" type="char[01]"/>
--NS>    </field>
--NS>  </class>
--NS>
--NS>  public class VortSentryModelDims implements Serializable, 
--NS>TimeStampable, Cloneable {
--NS>   ....
--NS>    private boolean combineBaseSlabRiser;
--NS>   ....
--NS>    public boolean isCombineBaseSlabRiser() {
--NS>        return combineBaseSlabRiser;
--NS>    }
--NS>
--NS>    public void setCombineBaseSlabRiser(boolean 
--combineBaseSlabRiser) {
--NS>        this.combineBaseSlabRiser=combineBaseSlabRiser;
--NS>    }
--NS>  }
--NS>
--NS>With the above mapping/class I get the following exception:
--NS>org.exolab.castor.mapping.MappingException: The method 
--NS>getcombineBaseSlabRiser in class 
--NS>com.vort.ads.vortsentry.beans.VortSentryModelDims 
--accepting/returning 
--NS>object of type null was not found
--NS>   at
--NS>org.exolab.castor.persist.FieldMolder.<init>(FieldMolder.java:583)
--NS>   at
--NS>org.exolab.castor.persist.ClassMolder.<init>(ClassMolder.java:367)
--NS>   at
--NS>org.exolab.castor.persist.ClassMolder.resolve(ClassMolder.java:519)
--NS>   at
--NS>org.exolab.castor.persist.LockEngine.<init>(LockEngine.java:168)
--NS>   at
--NS>org.exolab.castor.persist.PersistenceEngineFactory.createEn
--gine(Persi
--NS>ste
--NS>nceEngineFactory.java:83)
--NS>   at
--NS>org.exolab.castor.jdo.engine.DatabaseRegistry.<init>(Databa
--seRegistry
--NS>.ja
--NS>va:204)
--NS>   at
--NS>org.exolab.castor.jdo.engine.DatabaseRegistry.<init>(Databa
--seRegistry
--NS>.ja
--NS>va:163)
--NS>   at
--NS>org.exolab.castor.jdo.engine.DatabaseRegistry.loadDatabase(
--DatabaseRe
--NS>gis
--NS>try.java:294)
--NS>   at org.exolab.castor.jdo.JDO.getDatabase(JDO.java:583)
--NS>   at
--NS>com.vort.ads.utils.ProjectManager.loadProject(ProjectManage
--r.java:486)
--NS>   at
--NS>com.vort.ads.gui.project.JFrOpenProject.jBOpenActionPerform
--ed(JFrOpen
--NS>Pro
--NS>ject.....
--NS>
--NS>The interesting part is that it is "accepting/returning object of 
--NS>type null was not found" whats up with this? I am using a 
--recent CVS 
--NS>version, but I've noticed this happening in older versions as well.
--NS>Any ideas? What am I doing wrong that its not looking for 
--the write 
--NS>methods?
--
--Nick, 
--
--Please post the relevant portion of the client code that is 
--producing this exception. This might provide more info.
--
--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
--
--

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

Reply via email to