Mantis Bugtracker
  

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0001012 [Resin] minor always 03-23-06 15:54 04-04-06 16:19
Reporter ferg View Status public  
Assigned To ferg
Priority high Resolution fixed  
Status closed   Product Version 3.0.18
Summary 0001012: findByPrimaryKey with cached data
Description (rep by Christian Amott)

If I do a findByPrimaryKey on a bean that has been previously cached by resin and the cache period has expired, then resin will not actually do a re-load/select or check to see if it exists anymore until one of it's fields is accessed. It is only when something is done with one of it's fields or via cmr that an amber/ejb exception is thrown if the object has been removed from the db.

Thus, the findByPrimaryKey method itself does not generate an ObjectNotFoundException if the object no longer exists and if the bean has been previously cached - but it will if it's the first time the key has been asked for and it's not cached.

I am assuming that this is a bug ... or is this intended behaviour?

eg. see attached .ejb file

            try {
                    symbol = symbolHome.findByPrimaryKey(symbolId);
                } catch (FinderException e) {
                    // if the object doesn't exist in the db then an objectnotfoundexception is only thrown *if* the bean specified by the key has not been cached previously by resin, *even if* the cache period has expired
                }

        String name = symbol.getLongName(); // if the symbol object no longer exists in the db and the cache period has expired, then this will cause an AmberObjectNotFoundException ....

it's obviously incorrect for the findByPrimaryKey to not throw an exception if the object does not exist after the cache period has expired ... i need to be able to trap this.

Additional Information
Attached Files

- Relationships

- Notes
(0001011)
ferg
04-04-06 16:19

ejb/0aje
 

- Issue History
Date Modified Username Field Change
03-23-06 15:54 ferg New Issue
04-04-06 16:19 ferg Note Added: 0001011
04-04-06 16:19 ferg Assigned To  => ferg
04-04-06 16:19 ferg Status new => closed
04-04-06 16:19 ferg Resolution open => fixed
04-04-06 16:19 ferg Fixed in Version  => 3.0.19


Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
28 total queries executed.
25 unique queries executed.
Powered by Mantis Bugtracker