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 Edson Carlos Ericksson Richter <ed...@mgrinformatica.com.br> on 2004/03/08 14:44:31 UTC

Dinamic collection creation

Hi!

I'm using a bit modified OJB to get dynamic collections working. The problem is that I have a collection dynamically put that doesn't exists in the real bean. When I ask for store the main object, OJB tries to atore the collection as well (what is expected if the field in main bean really exists - and this is not my case as the collection was dynamically created for quering purposes only).

The problem appear be in the storeCollections method:

        Iterator i = listCds.iterator();

        while (i.hasNext())
        {
            CollectionDescriptor cds = (CollectionDescriptor) i.next();
            Object col = cds.getPersistentField().get(obj);
            Collection currentMtoNKeys = null;

As you can see, the call to cds.getPersistentField() occur even the collection descriptor is assing to "update=false" (throwing an exception since the persistent field don't exists in the bean). I think it's a wrong behaviour. Testing if the cds.getCascadeStore() before calling getPersistentField() could improve performance and solve undesired behaviour.

What do you all think?

Best regards,

Edson Richter


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.614 / Virus Database: 393 - Release Date: 5/3/2004

Re: Dinamic collection creation

Posted by Edson Carlos Ericksson Richter <ed...@mgrinformatica.com.br>.
I don't think my patches will fit into OJB sources, because to avoid overriding OJB default behaviour I'm depending on a "virtual" (the name is really "virtual") attribute (that doesn't exists in default OJB sources).

But if OJB behaviour be modified (and if the attributte isn't persistent it will not even try to getPersistentField, I can waste my "virtual" attribute and relay on default behaviour at all).

Thanks,

Edson Richter


  ----- Original Message ----- 
  From: Leandro Rodrigo Saad Cruz 
  To: OJB Users List 
  Sent: Monday, March 08, 2004 12:18 PM
  Subject: Re: Dinamic collection creation


  Could you send me the patches ?

  On Mon, 2004-03-08 at 11:39, Edson Carlos Ericksson Richter wrote:
  > Yes, I think so (I've patched my local OJB cvs sources to do this already), but I did like to see this merged into main sources (if is possible). This is the reason I've asked for this (btw, this is the second time I ask for).
  > 
  > 
  > Thanks,
  > 
  > Edson Richter
  >   ----- Original Message ----- 
  >   From: Leandro Rodrigo Saad Cruz 
  >   To: OJB Users List 
  >   Sent: Monday, March 08, 2004 11:00 AM
  >   Subject: Re: Dinamic collection creation
  > 
  > 
  >   Could you use <java>if(!cds.getCascadeStore()) continue;</java>
  >   to solve your problem ?
  > 
  >   On Mon, 2004-03-08 at 10:44, Edson Carlos Ericksson Richter wrote:
  >   > Hi!
  >   > 
  >   > I'm using a bit modified OJB to get dynamic collections working. The problem is that I have a collection dynamically put that doesn't exists in the real bean. When I ask for store the main object, OJB tries to atore the collection as well (what is expected if the field in main bean really exists - and this is not my case as the collection was dynamically created for quering purposes only).
  >   > 
  >   > The problem appear be in the storeCollections method:
  >   > 
  >   >         Iterator i = listCds.iterator();
  >   > 
  >   >         while (i.hasNext())
  >   >         {
  >   >             CollectionDescriptor cds = (CollectionDescriptor) i.next();
  >   >             Object col = cds.getPersistentField().get(obj);
  >   >             Collection currentMtoNKeys = null;
  >   > 
  >   > As you can see, the call to cds.getPersistentField() occur even the collection descriptor is assing to "update=false" (throwing an exception since the persistent field don't exists in the bean). I think it's a wrong behaviour. Testing if the cds.getCascadeStore() before calling getPersistentField() could improve performance and solve undesired behaviour.
  >   > 
  >   > What do you all think?
  >   > 
  >   > Best regards,
  >   > 
  >   > Edson Richter
  >   > 
  >   > 
  >   > ---
  >   > Outgoing mail is certified Virus Free.
  >   > Checked by AVG anti-virus system (http://www.grisoft.com).
  >   > Version: 6.0.614 / Virus Database: 393 - Release Date: 5/3/2004
  >   -- 
  >   Leandro Rodrigo Saad Cruz
  >   InterBusiness Tecnologia e Serviços
  >   OJB - db.apache.org/ojb
  >   XINGU - xingu.sf.net
  > 
  > 
  >   ---------------------------------------------------------------------
  >   To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
  >   For additional commands, e-mail: ojb-user-help@db.apache.org
  > 
  > 
  > 
  >   ---
  >   Outgoing mail is certified Virus Free.
  >   Checked by AVG anti-virus system (http://www.grisoft.com).
  >   Version: 6.0.614 / Virus Database: 393 - Release Date: 5/3/2004
  -- 
  Leandro Rodrigo Saad Cruz
  InterBusiness Tecnologia e Serviços
  OJB - db.apache.org/ojb
  XINGU - xingu.sf.net


  ---------------------------------------------------------------------
  To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
  For additional commands, e-mail: ojb-user-help@db.apache.org



  ---
  Outgoing mail is certified Virus Free.
  Checked by AVG anti-virus system (http://www.grisoft.com).
  Version: 6.0.614 / Virus Database: 393 - Release Date: 5/3/2004

Re: Dinamic collection creation

Posted by Leandro Rodrigo Saad Cruz <le...@ibnetwork.com.br>.
Could you send me the patches ?

On Mon, 2004-03-08 at 11:39, Edson Carlos Ericksson Richter wrote:
> Yes, I think so (I've patched my local OJB cvs sources to do this already), but I did like to see this merged into main sources (if is possible). This is the reason I've asked for this (btw, this is the second time I ask for).
> 
> 
> Thanks,
> 
> Edson Richter
>   ----- Original Message ----- 
>   From: Leandro Rodrigo Saad Cruz 
>   To: OJB Users List 
>   Sent: Monday, March 08, 2004 11:00 AM
>   Subject: Re: Dinamic collection creation
> 
> 
>   Could you use <java>if(!cds.getCascadeStore()) continue;</java>
>   to solve your problem ?
> 
>   On Mon, 2004-03-08 at 10:44, Edson Carlos Ericksson Richter wrote:
>   > Hi!
>   > 
>   > I'm using a bit modified OJB to get dynamic collections working. The problem is that I have a collection dynamically put that doesn't exists in the real bean. When I ask for store the main object, OJB tries to atore the collection as well (what is expected if the field in main bean really exists - and this is not my case as the collection was dynamically created for quering purposes only).
>   > 
>   > The problem appear be in the storeCollections method:
>   > 
>   >         Iterator i = listCds.iterator();
>   > 
>   >         while (i.hasNext())
>   >         {
>   >             CollectionDescriptor cds = (CollectionDescriptor) i.next();
>   >             Object col = cds.getPersistentField().get(obj);
>   >             Collection currentMtoNKeys = null;
>   > 
>   > As you can see, the call to cds.getPersistentField() occur even the collection descriptor is assing to "update=false" (throwing an exception since the persistent field don't exists in the bean). I think it's a wrong behaviour. Testing if the cds.getCascadeStore() before calling getPersistentField() could improve performance and solve undesired behaviour.
>   > 
>   > What do you all think?
>   > 
>   > Best regards,
>   > 
>   > Edson Richter
>   > 
>   > 
>   > ---
>   > Outgoing mail is certified Virus Free.
>   > Checked by AVG anti-virus system (http://www.grisoft.com).
>   > Version: 6.0.614 / Virus Database: 393 - Release Date: 5/3/2004
>   -- 
>   Leandro Rodrigo Saad Cruz
>   InterBusiness Tecnologia e Serviços
>   OJB - db.apache.org/ojb
>   XINGU - xingu.sf.net
> 
> 
>   ---------------------------------------------------------------------
>   To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>   For additional commands, e-mail: ojb-user-help@db.apache.org
> 
> 
> 
>   ---
>   Outgoing mail is certified Virus Free.
>   Checked by AVG anti-virus system (http://www.grisoft.com).
>   Version: 6.0.614 / Virus Database: 393 - Release Date: 5/3/2004
-- 
Leandro Rodrigo Saad Cruz
InterBusiness Tecnologia e Serviços
OJB - db.apache.org/ojb
XINGU - xingu.sf.net


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: Dinamic collection creation

Posted by Edson Carlos Ericksson Richter <ed...@mgrinformatica.com.br>.
Yes, I think so (I've patched my local OJB cvs sources to do this already), but I did like to see this merged into main sources (if is possible). This is the reason I've asked for this (btw, this is the second time I ask for).


Thanks,

Edson Richter
  ----- Original Message ----- 
  From: Leandro Rodrigo Saad Cruz 
  To: OJB Users List 
  Sent: Monday, March 08, 2004 11:00 AM
  Subject: Re: Dinamic collection creation


  Could you use <java>if(!cds.getCascadeStore()) continue;</java>
  to solve your problem ?

  On Mon, 2004-03-08 at 10:44, Edson Carlos Ericksson Richter wrote:
  > Hi!
  > 
  > I'm using a bit modified OJB to get dynamic collections working. The problem is that I have a collection dynamically put that doesn't exists in the real bean. When I ask for store the main object, OJB tries to atore the collection as well (what is expected if the field in main bean really exists - and this is not my case as the collection was dynamically created for quering purposes only).
  > 
  > The problem appear be in the storeCollections method:
  > 
  >         Iterator i = listCds.iterator();
  > 
  >         while (i.hasNext())
  >         {
  >             CollectionDescriptor cds = (CollectionDescriptor) i.next();
  >             Object col = cds.getPersistentField().get(obj);
  >             Collection currentMtoNKeys = null;
  > 
  > As you can see, the call to cds.getPersistentField() occur even the collection descriptor is assing to "update=false" (throwing an exception since the persistent field don't exists in the bean). I think it's a wrong behaviour. Testing if the cds.getCascadeStore() before calling getPersistentField() could improve performance and solve undesired behaviour.
  > 
  > What do you all think?
  > 
  > Best regards,
  > 
  > Edson Richter
  > 
  > 
  > ---
  > Outgoing mail is certified Virus Free.
  > Checked by AVG anti-virus system (http://www.grisoft.com).
  > Version: 6.0.614 / Virus Database: 393 - Release Date: 5/3/2004
  -- 
  Leandro Rodrigo Saad Cruz
  InterBusiness Tecnologia e Serviços
  OJB - db.apache.org/ojb
  XINGU - xingu.sf.net


  ---------------------------------------------------------------------
  To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
  For additional commands, e-mail: ojb-user-help@db.apache.org



  ---
  Outgoing mail is certified Virus Free.
  Checked by AVG anti-virus system (http://www.grisoft.com).
  Version: 6.0.614 / Virus Database: 393 - Release Date: 5/3/2004

Re: Dinamic collection creation

Posted by Leandro Rodrigo Saad Cruz <le...@ibnetwork.com.br>.
Could you use <java>if(!cds.getCascadeStore()) continue;</java>
to solve your problem ?

On Mon, 2004-03-08 at 10:44, Edson Carlos Ericksson Richter wrote:
> Hi!
> 
> I'm using a bit modified OJB to get dynamic collections working. The problem is that I have a collection dynamically put that doesn't exists in the real bean. When I ask for store the main object, OJB tries to atore the collection as well (what is expected if the field in main bean really exists - and this is not my case as the collection was dynamically created for quering purposes only).
> 
> The problem appear be in the storeCollections method:
> 
>         Iterator i = listCds.iterator();
> 
>         while (i.hasNext())
>         {
>             CollectionDescriptor cds = (CollectionDescriptor) i.next();
>             Object col = cds.getPersistentField().get(obj);
>             Collection currentMtoNKeys = null;
> 
> As you can see, the call to cds.getPersistentField() occur even the collection descriptor is assing to "update=false" (throwing an exception since the persistent field don't exists in the bean). I think it's a wrong behaviour. Testing if the cds.getCascadeStore() before calling getPersistentField() could improve performance and solve undesired behaviour.
> 
> What do you all think?
> 
> Best regards,
> 
> Edson Richter
> 
> 
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.614 / Virus Database: 393 - Release Date: 5/3/2004
-- 
Leandro Rodrigo Saad Cruz
InterBusiness Tecnologia e Serviços
OJB - db.apache.org/ojb
XINGU - xingu.sf.net


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org