Castor uses a caching mechanism that would probably account for the behaviour you are experiencing. The cache of the first JDO is invisible to the second, and vice-verse. When you use the db.load() method, the object will be loaded from the cache if it has been previous loaded. If you use an OQL query, then the cache is not used.

It is possible to set cache-type to "none" in the mapping, though this may not solve all of your problems if you have a high degree of concurrency. If the 2 JDO objects are both trying to update rows in the database simultaneously, you may get errors associated with the detection of dirty reads/writes.

I hope this helps.

Patrick

HAMMELL,THOMAS (HP-NewJersey,ex2) wrote:

I'm trying to use multiple JDO objects to access the same database in different ways. I have a database that I'm using to represent directories and files in a file system. I have two tables a directory table and a file table. In some operations when I load a directory I want to load all the corresponding files that are children of the directory. For other operations when I load a directory I don't want to load the corresponding files. To do this I created two mapping files one that specifies the relation between the directories and files and one that doesn't. I then created two JDO objects one corresponding to each mapping file. The problem is that both JDO objects give the same results when I retrieve a directory. For example I first create the JDO object which corresponds to the mapping file that defines a relation between the directories and files then I create the JDO object that corresponds to the mapping file that doesn't have a relationship between directories and files. If I use the second JDO object to retrieve a directory I get its corresponding files for some reason even though the second JDO object doesn't know the relationship between directories and files. If I create the JDO objects in the opposite order then I get the opposite behavior. It almost seems that there is some kind of caches that is happening that is preventing the second JDO object from being created correctly. Is this a know problem and if so how do I get around it. If it is not a know problem then I would like to add it to the bug list. If I did not explain the problem properly and you need more explanation let me know. I have a complete example that shows the problem.
Thanks
Tom

----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev


Reply via email to