Im going to repost this over here because Id really like to have this patch
checked in.

Actually Id also like to have CVS access so I could check it in myself.  Are
there some criteria for that?  Otherwise I guess I can keep mailing patches
to the list.

thanks
dave

> -----Original Message-----
> From: Castro, David 
> Sent: Thursday, February 15, 2001 9:36 AM
> To: 'JBoss-User'
> Subject: RE: [jBoss-User] RE: Why doesn't CMP 
> findByPrimaryKey lookup on
> c ache?
> 
> 
> ahh...
> 
> You're absolutely right.  I just changed and tested with:
>        // Check if findByPrimaryKey
>        // If so we check if the entity is in cache first
>        if (finderMethod.getName().equals("findByPrimaryKey"))
>        {
>           Object key = ctx.getCacheKey();
>           if (key == null)
>           {
>              key =
((EntityCache)con.getInstanceCache()).createCacheKey(args[0]);
>           } 
>           if (con.getInstanceCache().isActive(key))
>              return key; // Object is active -> it exists 
> 
> thanks
> The code actually works the other way, because in the constructor for
> org/jboss/ejb/plugins/jrmp/interfaces/EntityProxy.java (line 
> 80) we have:
> 
>       if (id instanceof CacheKey) {
>          this.cacheKey = (CacheKey) id;
>       }
>       else
>       {
>          // In case we pass the Object or anything else we encapsulate
>          cacheKey = new CacheKey(id);
>       }
> So it was just Marshalling a new CacheKey for me.  (which Im sure is
> inefficient).
> 
> Incidentally, in the BMP code we are also getting a new cache 
> key created
> every time, because callFinderMethod() returns the id and 
> then in findEntity
> we create a new cache key for it.  Im sure that the 
> marshalling involved is
> not free, and in any case it doesnt make sense to put the 
> code to handle
> findByPrimaryKey in a method (callFinderMethod) that is meant 
> to handle
> multi-finders.  I think we should move the above code from
> BMPPersistenceManager.callFinderMethod (line 433) to
> BMPPersistenceManager.findEntity (line 210) and return the 
> key instead of
> re-creating it.
> 
> -----Original Message-----
> From: Bordet, Simone [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, February 15, 2001 4:53 AM
> To: 'JBoss-User'
> Subject: RE: [jBoss-User] RE: Why doesn't CMP 
> findByPrimaryKey lookup on
> c ache?
> 
> 
> Hey David,
> 
> see below.
> 
> >       // Check if findByPrimaryKey
> >       // If so we check if the entity is in cache first
> >       if (finderMethod.getName().equals("findByPrimaryKey"))
> >       {
> >          Object key = ctx.getCacheKey();
> >          if (key == null)
> >          {
> >             key =
> > ((EntityCache)con.getInstanceCache()).createCacheKey(args[0]);
> >          }
> >          if (con.getInstanceCache().isActive(key))
> >             return args[0]; // Object is active -> it exists 
> 
> Here you'd better return key (not args[0]).
> 
> Simon
> 
> 
> --
> --------------------------------------------------------------
> To subscribe:        [EMAIL PROTECTED]
> To unsubscribe:      [EMAIL PROTECTED]
> List Help?:          [EMAIL PROTECTED]
> 
> 
> --
> --------------------------------------------------------------
> To subscribe:        [EMAIL PROTECTED]
> To unsubscribe:      [EMAIL PROTECTED]
> List Help?:          [EMAIL PROTECTED]
> 





---------------------------------------------------------------------
This message (including any attachments) contains confidential, proprietary
or privileged information intended for a specific purpose and individual(s),
and is protected by law.  If you receive this message in error, please
immediately delete it and all copies of it from your system, destroy any
hard copies of it and notify the sender.  Any unauthorized disclosure,
copying or distribution of any part of this message, or the taking of any
unauthorized action based on it, is strictly prohibited.

Reply via email to