Community
Participate
Working Groups
Build Identifier: 2.1.1.v20100817-r8050 Can`t use custom add target query in org.eclipse.persistence.mappings.OneToManyMapping. I am trying to call setCustomAddTargetQuery(x) from my implementation of DescriptorCustomizer. However, the way org.eclipse.persistence.mappings.OneToManyMapping.initializeAddTargetQuery implemented my overrided addTargetQuery is not used. Check for hasCustomAddTargetQuery is done AFTER addTargetQuery is initialized (ignoring any addTargetQuery set before). This obviously wrong, take a look at initializeRemoveTargetQuery. Reproducible: Always Steps to Reproduce: 1. Implement DescriptorCustomizer which calls OneToManyMapping.setCustomAddTargetQuery 2. Invoke JPA 3. Observe NPE at StatementQueryMechanism.setCallFromStatement because standard addTargetQuery is not properly initialized
Created attachment 184368 [details] Patch for this problem (preview version, not well tested)
If you haven't done so, it is likely a good idea to go through the mailing lists or forums prior to posting these kinds of bugs. The reason: There is a good chance someone will be able to provide you with a reasonable workaround.
> If you haven't done so, it is likely a good idea to go through the mailing > lists or forums prior to posting these kinds of bugs. The reason: There is a > good chance someone will be able to provide you with a reasonable workaround. Generally speaking - yes. But in this situation it is clearly visible bug. I would like to have fix for this problem, not workaround.
Please vote for bugs you find important. We generally prioritize bugs with larger number of votes and with patches submitted by the community ahead of bugs that have neither of these things. Often a workaround is a good way of allowing your application to work until your bug makes it way to the head of the priority queue.
Setting target and priority. See the following page for the meanings of these fields: http://wiki.eclipse.org/EclipseLink/Development/Bugs/Guidelines
Created attachment 185666 [details] Updated patch with test
Checked in slightly modified changes and added test case to trunk Reviewed by: Tom Ware - reviewed community-submitted-fix Added test to EntityManagerJUnitTestSuite Tested with JPA and Core LRG
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink