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 Sean Dockery <sd...@securac.net> on 2004/03/31 18:54:38 UTC

Behavior of ODMG personality and many-to-many relationships and default cache implementation

Consider the following classes that represent a many-to-many relationship:

public class Category {

	private Collection products;

	public Collection getProducts() {
		return products;
	}

	public void setProducts(Collection newProducts) {
		products = newProducts;
	}

}

public class Products {

	private Collection categories;

	public Collection getCategories() {
		return categories;
	}

	public void setCategories(Collection newCategories) {
		categories = newCategories;
	}

}

If I have categories A and B, and products X and Y.  Initially category 
A contains only product X, and category B contains only product Y.

If I have fetched category A into the cache, then load product Y, and 
modify it thusly...

productY.getCategories().add(categoryA);

...and save it, the correct record is inserted into the indirection 
table describing the relationship between categoryA and productY. 
However, the cached copy of A is not updated with the new relationship. 
  If categoryA is purged from the cache and re-materialized, it contains 
both X and Y in its products collection.

Is this correct behavior or is this a bug?  If it is a bug, will it be 
fixed before 1.0 final is released?

Thanks...



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


Re: Behavior of ODMG personality and many-to-many relationships and default cache implementation

Posted by Sean Dockery <sd...@securac.net>.
No takers?

Sean Dockery wrote:

> Consider the following classes that represent a many-to-many relationship:
> 
> public class Category {
> 
>     private Collection products;
> 
>     public Collection getProducts() {
>         return products;
>     }
> 
>     public void setProducts(Collection newProducts) {
>         products = newProducts;
>     }
> 
> }
> 
> public class Products {
> 
>     private Collection categories;
> 
>     public Collection getCategories() {
>         return categories;
>     }
> 
>     public void setCategories(Collection newCategories) {
>         categories = newCategories;
>     }
> 
> }
> 
> If I have categories A and B, and products X and Y.  Initially category 
> A contains only product X, and category B contains only product Y.
> 
> If I have fetched category A into the cache, then load product Y, and 
> modify it thusly...
> 
> productY.getCategories().add(categoryA);
> 
> ...and save it, the correct record is inserted into the indirection 
> table describing the relationship between categoryA and productY. 
> However, the cached copy of A is not updated with the new relationship. 
>  If categoryA is purged from the cache and re-materialized, it contains 
> both X and Y in its products collection.
> 
> Is this correct behavior or is this a bug?  If it is a bug, will it be 
> fixed before 1.0 final is released?
> 
> Thanks...


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


Re: Behavior of ODMG personality and many-to-many relationships and default cache implementation

Posted by Jakob Braeuchi <jb...@gmx.ch>.
hi sean,

when you add a category to the a products you should also make the vece-versa 
connection categoryA.getProducts().add(productY). ojb does not do this 
automatically (at least it did not before i went on vacation...)

hth
jakob

Sean Dockery wrote:

> Consider the following classes that represent a many-to-many relationship:
> 
> public class Category {
> 
>     private Collection products;
> 
>     public Collection getProducts() {
>         return products;
>     }
> 
>     public void setProducts(Collection newProducts) {
>         products = newProducts;
>     }
> 
> }
> 
> public class Products {
> 
>     private Collection categories;
> 
>     public Collection getCategories() {
>         return categories;
>     }
> 
>     public void setCategories(Collection newCategories) {
>         categories = newCategories;
>     }
> 
> }
> 
> If I have categories A and B, and products X and Y.  Initially category 
> A contains only product X, and category B contains only product Y.
> 
> If I have fetched category A into the cache, then load product Y, and 
> modify it thusly...
> 
> productY.getCategories().add(categoryA);
> 
> ...and save it, the correct record is inserted into the indirection 
> table describing the relationship between categoryA and productY. 
> However, the cached copy of A is not updated with the new relationship. 
>  If categoryA is purged from the cache and re-materialized, it contains 
> both X and Y in its products collection.
> 
> Is this correct behavior or is this a bug?  If it is a bug, will it be 
> fixed before 1.0 final is released?
> 
> Thanks...
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
> 
> 

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


Re: Behavior of ODMG personality and many-to-many relationships and default cache implementation

Posted by Sean Dockery <sd...@securac.net>.
Still no takers?  :-(

Sean Dockery wrote:

> No takers?
> 
> Sean Dockery wrote:
> 
>> Consider the following classes that represent a many-to-many 
>> relationship:
>>
>> public class Category {
>>
>>     private Collection products;
>>
>>     public Collection getProducts() {
>>         return products;
>>     }
>>
>>     public void setProducts(Collection newProducts) {
>>         products = newProducts;
>>     }
>>
>> }
>>
>> public class Products {
>>
>>     private Collection categories;
>>
>>     public Collection getCategories() {
>>         return categories;
>>     }
>>
>>     public void setCategories(Collection newCategories) {
>>         categories = newCategories;
>>     }
>>
>> }
>>
>> If I have categories A and B, and products X and Y.  Initially 
>> category A contains only product X, and category B contains only 
>> product Y.
>>
>> If I have fetched category A into the cache, then load product Y, and 
>> modify it thusly...
>>
>> productY.getCategories().add(categoryA);
>>
>> ...and save it, the correct record is inserted into the indirection 
>> table describing the relationship between categoryA and productY. 
>> However, the cached copy of A is not updated with the new 
>> relationship.  If categoryA is purged from the cache and 
>> re-materialized, it contains both X and Y in its products collection.
>>
>> Is this correct behavior or is this a bug?  If it is a bug, will it be 
>> fixed before 1.0 final is released?
>>
>> Thanks...


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


Re: Behavior of ODMG personality and many-to-many relationships and default cache implementation

Posted by Sean Dockery <sd...@securac.net>.
No takers?

Sean Dockery wrote:

> Consider the following classes that represent a many-to-many relationship:
> 
> public class Category {
> 
>     private Collection products;
> 
>     public Collection getProducts() {
>         return products;
>     }
> 
>     public void setProducts(Collection newProducts) {
>         products = newProducts;
>     }
> 
> }
> 
> public class Products {
> 
>     private Collection categories;
> 
>     public Collection getCategories() {
>         return categories;
>     }
> 
>     public void setCategories(Collection newCategories) {
>         categories = newCategories;
>     }
> 
> }
> 
> If I have categories A and B, and products X and Y.  Initially category 
> A contains only product X, and category B contains only product Y.
> 
> If I have fetched category A into the cache, then load product Y, and 
> modify it thusly...
> 
> productY.getCategories().add(categoryA);
> 
> ...and save it, the correct record is inserted into the indirection 
> table describing the relationship between categoryA and productY. 
> However, the cached copy of A is not updated with the new relationship. 
>  If categoryA is purged from the cache and re-materialized, it contains 
> both X and Y in its products collection.
> 
> Is this correct behavior or is this a bug?  If it is a bug, will it be 
> fixed before 1.0 final is released?
> 
> Thanks...


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