| Summary: | Exceptions (NPE and other) during commit() or flush() when using MAP for 1:n relations | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | z_Archived | Reporter: | roman Mising name <romo.dyn1> | ||||||
| Component: | Eclipselink | Assignee: | Project Inbox <eclipselink.orm-inbox> | ||||||
| Status: | NEW --- | QA Contact: | |||||||
| Severity: | major | ||||||||
| Priority: | P2 | CC: | leonard.oancea, tom.ware | ||||||
| Version: | unspecified | ||||||||
| Target Milestone: | --- | ||||||||
| Hardware: | All | ||||||||
| OS: | All | ||||||||
| Whiteboard: | |||||||||
| Attachments: |
|
||||||||
|
Description
roman Mising name
Created attachment 208102 [details]
eclipse project to reproduce errors (unittests)
Created attachment 208103 [details]
same as testEclipseLinkMap but using Set for relations
disabling the shared cache helps a lot, but some errors still occur. Setting target and priority. See the following page for the meanings of these fields: http://wiki.eclipse.org/EclipseLink/Development/Bugs/Guidelines Community: Please vote for this bug if it is important to you. Votes are one of the main criteria we use to determine which bugs to fix next. in 2.4.0
for a 1-M relation using a map with table key , on remove the SQL transaction is commited , but cache is not , a NPE is thrown
@OneToMany(fetch = FetchType.LAZY, targetEntity = Child.class,
mappedBy = "direct", cascade = { CascadeType.REMOVE },
orphanRemoval = true)
@MapKeyColumn(name = "child_name", table = "child", insertable = false,
updatable = false)
@Cache(type = CacheType.HARD_WEAK, size = 10000, expiry = -1,
alwaysRefresh = true, isolation = CacheIsolationType.SHARED,
coordinationType = CacheCoordinationType.INVALIDATE_CHANGED_OBJECTS)
@Cacheable(value = true)
org.eclipse.persistence.internal.queries.MapContainerPolicy
key = null
element !=null
public boolean removeFrom(Object key, Object element, Object container, AbstractSession session) {
try {
Object returnValue = null;
if (key != null) {
returnValue = ((Map)container).remove(key);
} else if (element != null) {
!!!!
returnValue = ((Map)container).remove(keyFrom(element, session));
### hier comes a NullPointerException
!!!
}
if (returnValue == null) {
return false;
} else {
return true;
}
} catch (UnsupportedOperationException ex) {
throw QueryException.methodNotValid(container, "remove(Object element)");
}
}
the keyFrom function returns a null
org.eclipse.persistence.internal.queries.MappedKeyMapContainerPolicy
public Object keyFrom(Object element, AbstractSession session) {
// key is mapped to the database table and not the object and therefore cannot be extracted from the object
if (keyMapping != null){
return null;
}
return super.keyFrom(element, session);
}
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink |