openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Minor" <davemi...@gmail.com>
Subject Data cache weirdness
Date Fri, 03 Oct 2008 23:24:50 GMT
If I have the data cache turned on, the map key for the collection
below seems to be of the wrong type (org.apache.openjpa.util.LongId
instead of Catalog). Attempting to iterate through the keySet throws a
ClassCastException to that effect. If I do an explicit cast to LongId
and call getId, it appears to have the IDs of the Catalogs that I'm
expecting to be there.

When I turn the cache off it works fine.


The mapped collection:

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

The corresopnding field in CatalogProductPriceImpl is this:

@ManyToOne(optional = false, targetEntity = CatalogImpl.class, cascade
= { CascadeType.REFRESH })
@JoinColumn(name = "CATALOG_UID", nullable = false)
@ForeignKey
public Catalog getCatalog() {
	return catalog;
}



-- 
_____________
David Minor

Mime
View raw message