Hi Markus,
[EMAIL PROTECTED] wrote:
Hello
I have the problem with 1:n relationship mentioned on other postings. I have a group which knows 0:n articles and an article knows his group. When I create an article (article1), set the group and store it, The group object in cache isn't updated and doesn't contain the newly saved article1. I could solve this with the attribute refresh='true' in the collection-descriptor.
This depends on the used cache implementation. Detailed info can be found in http://db.apache.org/ojb/docu/guides/objectcache.html#ObjectCacheDefaultImpl
With more data in the db this became a problem because the system makes a lot of db-calls always to refresh the references, so I set refresh="false" again and was looking for another solution.
another option will be the use of collection proxy http://db.apache.org/ojb/docu/faq.html#proxyClasses
But now with the new Version 1.0.3 the references are refreshed automaticaly without refresh set to true. This is a change I haven't seen Mentioned.
In the sample repository file now the two-level cache was used. http://db.apache.org/ojb/repository_database.xml.txt
So here are my questions - How do I solve the problem with adding a new Item on the n-Side. Do I always have to add it to the object on the 1-side? Doesn't OJB do this for me?
Think this can be a caching issue or can depend on the used api (PB, ODMG), property settings (e.g. auto-update setting).
Article a = new Article();
a.setProductGroup(p);
...
store/persist a
then the next lookup of the ProductGroup p will contain the new 'a' Article. Except you are using a cache (e.g. ObjectCacheDefaultImpl) that does not refresh the object references.
regards, Armin
- What about the refreshing of my whole object-graph. Can the refreshing be sitched of (as it was with 1.0.1)? How can I solve the problem with loading referenced objects? Do I have to use Proxy-Classes.
I hope someone can help.
Thanks Markus
Markus Lauber Bedag Informatik AG - Software Entwicklung Gutenbergstrasse 3, 3011 Bern Telefon 031 633 21 21 (direkt 26 57) Telefax 031 382 35 56 E-Mail: mailto:[EMAIL PROTECTED] Internet: http://www.bedag.ch
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
