You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Thomas Quaile <to...@yahoo.com> on 2003/02/24 20:13:38 UTC

Reference Descriptor Auto-Update problem

I'm having a problem with auto-update on the
reference-descriptor.  It just maybe that I'm not
understand how this works.

I have an object that contains the following field
descriptor and reference descriptor;

<field-descriptor
    name="sexId"
    column="sex_id"
    jdbc-type="INTEGER"
/>

<reference-descriptor
    name="sex"
   
class-ref="com.tabch.mdops.framework.businessobjects.sexBO"
    auto-retrieve="false"
    auto-update="false">
    <foreignkey field-id-ref="14">
</reference-descriptor>

I'm manually setting the sexId field before I persist
the object, I am not setting the referenced object
which is null.  I would think auto-update would allow
me to do this, but when I look at the data in the
database base my sexId field is null.

Am I misunderstanding how this works?  Is there a way
for me to do what I want.  That is, persist the sexId
field, but not the object.  But when I read the data
back in, I do want the referenced object to be loaded,
just not when I persist.

Thanks...

__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - forms, calculators, tips, more
http://taxes.yahoo.com/

Re: PersistenceBrokerFactoryIF.instantiate(): strange behavior

Posted by Armin Waibel <ar...@code-au-lait.de>.
Hi Joerg,

there is a known bug in 0.9.9
to patch this see

http://archives.apache.org/eyebrowse/ReadMsg?listName=ojb-user@jakarta.a
pache.org&msgNo=5507

or try to use
db.open("default#userName#password", Database.OPEN_READ_WRITE);

regards,
Armin


----- Original Message -----
From: "Joerg Lensing" <in...@softcon-lensing.de>
To: "OJB Users List" <oj...@db.apache.org>
Sent: Tuesday, February 25, 2003 3:30 PM
Subject: PersistenceBrokerFactoryIF.instantiate(): strange behavior


> Hi all,
> look at this:
>
>                     Database db = impl.newDatabase();
>
>                     try {
> --->>                   db.open("default", Database.OPEN_READ_WRITE);
>                         int i = 1;
>                     } catch (ODMGException ex) {
>                         ex.printStackTrace();
>                     }
>
> runs to:
>     private static PersistenceBrokerFactoryIF instantiate() {
>         if (log.isDebugEnabled())
>             log.debug("Instantiate PersistenceBrokerFactory");
>         try {
>             Configurator configurator = OjbConfigurator.getInstance();
> file://HERE: the code steps  OVER the next two lines! (without being
executed!)
>
>
>             Configuration config =
configurator.getConfigurationFor(null);
>             Class pbfClass =
> config.getClass("PersistenceBrokerFactoryClass",
> PersistenceBrokerFactoryDefaultImpl.class);
>             PersistenceBrokerFactoryIF result =
> (PersistenceBrokerFactoryIF) pbfClass.newInstance();
>             configurator.configure(result);
>             if (log.isDebugEnabled())
>                 log.debug("PersistencebrokerFactory class: " +
> pbfClass.getName());
>             return result;
>         } catch (Exception e) {
>             log.error("Fehler joerg222", e);
>             log.error("Error in instantiation of
> PersistenceBrokerFactory class", e);
>             return new PersistenceBrokerFactoryDefaultImpl();
>         }
>     }
>
>
> joerg
> ps: until now i didn't get it to work - nothing -:(
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>
>


PersistenceBrokerFactoryIF.instantiate(): strange behavior

Posted by Joerg Lensing <in...@softcon-lensing.de>.
Hi all,
look at this:

                    Database db = impl.newDatabase();

                    try {
--->>                   db.open("default", Database.OPEN_READ_WRITE);
                        int i = 1;
                    } catch (ODMGException ex) {
                        ex.printStackTrace();
                    }

runs to:
    private static PersistenceBrokerFactoryIF instantiate() {
        if (log.isDebugEnabled())
            log.debug("Instantiate PersistenceBrokerFactory");
        try {
            Configurator configurator = OjbConfigurator.getInstance(); 
//HERE: the code steps  OVER the next two lines! (without being executed!)
                                                                        
                           
            Configuration config = configurator.getConfigurationFor(null);
            Class pbfClass = 
config.getClass("PersistenceBrokerFactoryClass", 
PersistenceBrokerFactoryDefaultImpl.class);
            PersistenceBrokerFactoryIF result = 
(PersistenceBrokerFactoryIF) pbfClass.newInstance();
            configurator.configure(result);
            if (log.isDebugEnabled())
                log.debug("PersistencebrokerFactory class: " + 
pbfClass.getName());
            return result;
        } catch (Exception e) {
            log.error("Fehler joerg222", e);
            log.error("Error in instantiation of 
PersistenceBrokerFactory class", e);
            return new PersistenceBrokerFactoryDefaultImpl();
        }
    }


joerg
ps: until now i didn't get it to work - nothing -:(


Re: Reference Descriptor Auto-Update problem

Posted by Thomas Quaile <to...@yahoo.com>.
I've tried that, and I'm still have the same problem. 
I'm using 0.9.8 and PersistanceBroker as my
implementation.

Any help would be greatly appreciated.

Tom
--- Thomas Mahler <th...@web.de> wrote:
> Hi Thomas,
> 
> Thomas Quaile wrote:
> > I'm having a problem with auto-update on the
> > reference-descriptor.  It just maybe that I'm not
> > understand how this works.
> > 
> > I have an object that contains the following field
> > descriptor and reference descriptor;
> > 
> > <field-descriptor
> >     name="sexId"
> >     column="sex_id"
> >     jdbc-type="INTEGER"
> > />
> > 
> > <reference-descriptor
> >     name="sex"
> >    
> >
>
class-ref="com.tabch.mdops.framework.businessobjects.sexBO"
> >     auto-retrieve="false"
> >     auto-update="false">
> >     <foreignkey field-id-ref="14">
> > </reference-descriptor>
> > 
> > I'm manually setting the sexId field before I
> persist
> > the object, I am not setting the referenced object
> > which is null.  I would think auto-update would
> allow
> > me to do this, but when I look at the data in the
> > database base my sexId field is null.
> > 
> > Am I misunderstanding how this works?  Is there a
> way
> > for me to do what I want.  That is, persist the
> sexId
> > field, but not the object.  
> 
> that's done by auto-update="false"
> 
> > But when I read the data
> > back in, I do want the referenced object to be
> loaded,
> > just not when I persist.
> 
> You have to use auto-retrieve="true" for this!
> 
> cheers,
> Thomas
> 
> > 
> > Thanks...
> > 
> > __________________________________________________
> > Do you Yahoo!?
> > Yahoo! Tax Center - forms, calculators, tips, more
> > http://taxes.yahoo.com/
> > 
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> ojb-user-unsubscribe@db.apache.org
> > For additional commands, e-mail:
> ojb-user-help@db.apache.org
> > 
> > 
> 
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail:
> ojb-user-help@db.apache.org
> 


__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - forms, calculators, tips, more
http://taxes.yahoo.com/

Re: Reference Descriptor Auto-Update problem

Posted by Thomas Mahler <th...@web.de>.
Hi Thomas,

Thomas Quaile wrote:
> I'm having a problem with auto-update on the
> reference-descriptor.  It just maybe that I'm not
> understand how this works.
> 
> I have an object that contains the following field
> descriptor and reference descriptor;
> 
> <field-descriptor
>     name="sexId"
>     column="sex_id"
>     jdbc-type="INTEGER"
> />
> 
> <reference-descriptor
>     name="sex"
>    
> class-ref="com.tabch.mdops.framework.businessobjects.sexBO"
>     auto-retrieve="false"
>     auto-update="false">
>     <foreignkey field-id-ref="14">
> </reference-descriptor>
> 
> I'm manually setting the sexId field before I persist
> the object, I am not setting the referenced object
> which is null.  I would think auto-update would allow
> me to do this, but when I look at the data in the
> database base my sexId field is null.
> 
> Am I misunderstanding how this works?  Is there a way
> for me to do what I want.  That is, persist the sexId
> field, but not the object.  

that's done by auto-update="false"

> But when I read the data
> back in, I do want the referenced object to be loaded,
> just not when I persist.

You have to use auto-retrieve="true" for this!

cheers,
Thomas

> 
> Thanks...
> 
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Tax Center - forms, calculators, tips, more
> http://taxes.yahoo.com/
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
> 
>