Yes, I am using ODMG.

I have downloaded RC7 this morning and tried again. The collection proxy
works fine, but I still have problems with the reference proxies. Here is
the code snippet I am executing :

      public void testModificationDirect() {
            String idDossier = "test.ojb.1000";

            try {
                  Implementation impl = OJB.getInstance();
                  Database db = impl.newDatabase();
                  db.open("TESTDEV", Database.OPEN_READ_WRITE);
                  Transaction tx = impl.newTransaction();
                  tx.begin();

                  OQLQuery q = impl.newOQLQuery();
                  q.create("select dossiers from " + DossierImpl.class
.getName() + " where id = $1");
                  q.bind(idDossier);
                  DList results = (DList) q.execute();
                  Dossier d = (DossierImpl) results.iterator().next();
                  assertNotNull(d);
                  tx.lock(d,Transaction.WRITE);
                  for (Iterator iter = d.getPrestations().iterator();
iter.hasNext();) {
                        Prestation prest = (Prestation) iter.next();
                        prest.setMontant(prest.getMontant().add(new
BigDecimal("100")));
                  }
                  tx.commit();
            } catch (Exception e) {
                  e.printStackTrace();
                  fail();
            }
      }

The object of type Dossier is retrieved correctly. It has a real
RemovalAwareCollection of non materialized proxies. But then arise the
problems :
- at the first method invocation on one of the proxies
(prest.setMontant(...)) all the proxies of the collection are materialized,
not only the current one;
- at the commit, the real objects are not stored in the database. The java
object are updated, but OJB does not realise that they were and does not
report the new state in the database. If I try without proxies, the update
is made. If I put a proxy on the collection, everithig works fine too.

I don't join other information for now, just ask me what you need to
dignosticate the problem.

Stefano




|---------+--------------------------------->
|         |           Brian McCallister     |
|         |           <[EMAIL PROTECTED]|
|         |           ompany.com>           |
|         |                                 |
|         |           11.06.2004 17:57      |
|         |           Veuillez répondre à   |
|         |           "OJB Users List"      |
|         |                                 |
|---------+--------------------------------->
  
>----------------------------------------------------------------------------------------------------------------------|
  |                                                                                    
                                  |
  |        Pour :   "OJB Users List" <[EMAIL PROTECTED]>                               
                             |
  |        cc :                                                                        
                                  |
  |        Objet :  Re: Réf. : Re: My proxies do not make late binding                 
                                  |
  
>----------------------------------------------------------------------------------------------------------------------|




Assuming you are using ODMG...

The problem was with the implicit locking mechanism in the ODMG
implementation. It was not properly detecting collection proxies so it
would iterate over the collection (loading it) and lock every object
before even returning from the OQLQuery#execute() call.

I have fixed this in cvs so that it will register itself as a
materialization listener on any implementation of CollectionProxy which
has not yet been loaded, and only bind the contents of the collection
to the transaction if the collection is loaded during the transaction.

If you are using the default proxies, you should be fine if you pull
the version from CVS, or use the release coming up (if Thomas D.
retracts his vote to go to 1.0 final instead of an rc ;-) this weekend.

-Brian

On Jun 11, 2004, at 11:45 AM, Thomas Dudziak wrote:

> On Fri, 11 Jun 2004 [EMAIL PROTECTED] wrote:
>
>> I looked at the URL you sent me, but I dont know enough the internals
>> of
>> OJB to understand the message. I went a little further : I tried to
>> get the
>> Persistence Broker from the transaction and to execute a good old OJB
>> QueryByCriteria : the late binding works.
>
> Yup, the problem is with ODMG, not with the PB Api.
>
>> Besides that, I am not sure that the problem is only with the
>> collection
>> proxy. I have also tried with single-object dynamic proxies and the
>> same
>> result (returns already materialized proxies).
>
> They should work (might depend on how old the OJB version is that
> you're using though). As I said, please try the latest from CVS.
>
>> Wish you a happy week-end
>
> Same for you :-)
>
> Tom
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to