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