Hello,

If my example is simple, the real code is not so simple!

The program - which is running alone - tries to upgrade the content of a
database which contents application parameters (a new version of the
application will bring many new objects in different "tables", and
modification in some existing objects).

The process may be long, and in fact when we need to read the object, we
have not anymore the object's reference: we have only keywords to retrieve
it from database by an oql query.

If, in the example, I use directly jdbc, and not jdo, the query retrieves
the new object.

Is the cache could make me trouble in this case?


Sylvie.


___________________
CREDI RA
Sylvie Palluel

[EMAIL PROTECTED]
___________________


> -----Message d'origine-----
> De : Marco Mistroni [mailto:[EMAIL PROTECTED]
> Envoyé : mardi 9 novembre 2004 14:27
> À : [EMAIL PROTECTED]
> Objet : Re: [castor-dev] [jdo] Reading, in the same transaction, a data
> just created (reading via oql query)
> 
> Hello,
>       Why would you want to re-read again if you have created before?
> Is there the possibility that the object can be updated by other objects
> during same transaction?
> 
> Regards
>       marco
> 
> -----Original Message-----
> From: SYLVIE PALLUEL [mailto:[EMAIL PROTECTED]
> Sent: 09 November 2004 12:43
> To: [EMAIL PROTECTED]
> Subject: [castor-dev] [jdo] Reading, in the same transaction, a data
> just created (reading via oql query)
> 
> Sorry!
> Here's the complete message ...
> 
> Hi,
> 
> In a transaction (between the db.begin() and the db.commit()), I'm
> creating
> a new object A .
> And then, far away in the code, but in the same transaction, I need to
> read
> again the object A to create another object B.
> To do this, as I have no longer the id, I'm usinq an oql query to
> retrieve
> A... But it is not found...
> What can I do (castor configuration or special command) to be able to
> read
> it by an oql query ?
> 
> 
> db.begin();
> 
> log.info(" Creating object dossier via jdo ");
> Dossier dossierAjoute = new Dossier();
> dossierAjoute.setNomPatronymique("LEGRAND");
> dossierAjoute.setPrenom("ALEXANDRE");
> dossierAjoute.setCivilite("M");
> dossierAjoute.setNumNatident("11111111111");
> 
> db.create(dossierAjoute);
> 
> 
> log.info(" Reading back the object just created via jdo "); lesDossiers
> =
> RequetesJdoAssure.getLesDossiers("LEGRAND", "%", "ALEXANDRE", "%", db);
> log.info(" Nbre de dossiers = " + lesDossiers.size()); // The result
> will be
> 0 ... for (Iterator iter = lesDossiers.iterator(); iter.hasNext();) {
>       Dossier element = (Dossier) iter.next();
>       log.info(" Nom Apres creation = " + element.getNomPatronymique()
> + "
> - Prénom après creation = " + element.getPrenom()); }
> 
> // if I had the object if I could do this ...
> log.info(" Reading back the object by db.load() ");
> Dossier dossier=(Dossier)
> db.load(Class.forName("fr.cnam.scapin.metier.donnees.dossiers.Dossier"),
> new
> Integer(dossierAjoute.getIdDossier()));
> // this will be ok
> log.info("Dossier relu par db.load " + dossier.toString());
> 
> db.rollback();
> 
> 
> 
> Thanks for your help.
> 
> Sylvie
> ___________________
> CREDI RA
> Sylvie Palluel
> 
> [EMAIL PROTECTED]
> ___________________
> 
> 
> > -----Message d'origine-----
> > De : SYLVIE PALLUEL [mailto:[EMAIL PROTECTED]
> > Envoyé : mardi 9 novembre 2004 13:23
> > À : [EMAIL PROTECTED]
> > Objet : [castor-dev] [castor-user][jdo] Reading, in the same
> transaction,
> > a data just created (reading via oql query)
> >
> > Hi,
> >
> > In a transaction (between the db.begin() and the db.commit()), I'm
> > creating
> > a new object A .
> > And then, far away in the code, but in the same transaction, I need to
> > read
> > again the object A to create another object B.
> > To do this, as I have no longer the id, I'm usinq an oql query to
> retrieve
> > A... But it is not found...
> > What can I do (castor configuration or special command) to be able to
> read
> > it by an oql query ?
> >
> >  .

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

Reply via email to