[ 
https://issues.apache.org/jira/browse/OPENJPA-1205?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Simon Droscher updated OPENJPA-1205:
------------------------------------

    Description: 
Consider the following mapping, which uses a Map of a PC class to another PC 
class:

@OneToMany(targetEntity = CatalogProductPriceImpl.class, cascade = { 
CascadeType.ALL })
@MapKey(name = "catalog")
public Map<Catalog, CatalogPrice> getCatalogPrices() {
  return catalogPrices;
}

With the DataCache on, when a product is retrieved for the first time, this map 
will be correct. However, the next time it is retrieved (i.e. from the cache), 
what is returned is a Map<LongId, CatalogPrice> not the expected Map<Catalog, 
CatalogPrice>.

The attached patch resolves this issue.

  was:
Consider the following mapping, which uses a Map of a PC class to another PC 
class:

@OneToMany(targetEntity = CatalogProductPriceImpl.class, cascade = { 
CascadeType.ALL })
@MapKey(name = "catalog")
public Map<Catalog, CatalogPrice> getCatalogPrices() {
  return catalogPrices;
}

With the DataCache on, when a product is retrieved for the first time, this map 
will be correct. However, the next time it is retrieved (i.e. from the cache), 
what is returned is a Map<LongId, CatalogPrice> not the expected Map<Catalog, 
CatalogPrice>.


> Cannot retrieve Map<PersistenceCapable, PersistenceCapable> fields when 
> DataCache is on
> ---------------------------------------------------------------------------------------
>
>                 Key: OPENJPA-1205
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1205
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: datacache
>    Affects Versions: 1.2.1
>            Reporter: Simon Droscher
>         Attachments: EntityToEntityMapFix.patch
>
>
> Consider the following mapping, which uses a Map of a PC class to another PC 
> class:
> @OneToMany(targetEntity = CatalogProductPriceImpl.class, cascade = { 
> CascadeType.ALL })
> @MapKey(name = "catalog")
> public Map<Catalog, CatalogPrice> getCatalogPrices() {
>   return catalogPrices;
> }
> With the DataCache on, when a product is retrieved for the first time, this 
> map will be correct. However, the next time it is retrieved (i.e. from the 
> cache), what is returned is a Map<LongId, CatalogPrice> not the expected 
> Map<Catalog, CatalogPrice>.
> The attached patch resolves this issue.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to