Community
Participate
Working Groups
Build Identifier: 20110916-0149 when using Map for 1:n relations, a lot of different errors occur on commit() (mostly, sometimes on flush()). If a flush() is added/removed/changed position, the error does not occur or another error is reported. Most of the errors seems to relate to the caching subsystem. more details on the forum http://www.eclipse.org/forums/index.php/mv/msg/263510/761327/#msg_761327 I will upload a test project with different unittests, that shows samples, when errors occur. In the test cases, there are comments, how to workaround the errors. I will upload a second test project. It has the same unittests, the only difference is, that Set instead of Map is used for 1:n relations. In this test project all unittests work. So the errors has to be related to the implementation of the Map for relations. Reproducible: Always Steps to Reproduce: run unittests of enclosed projects (against an oracle database)
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