I added a ERXEnterpriseObjectCache to my entity and when some of my old code
tries to query the database instead of using the cache EOF throws the following
exception. If I defer loading the cache (shouldFetchInitialValues=false)
everything works. Is this a Wonder, EOF,… bug?
[2013-02-04 15:41:16,593] <performWork> ERROR Exception:
java.lang.NullPointerException - null
NullPointerException
at
com.webobjects.eoaccess.EODatabaseContext._objectFaultWithSnapshotRelationshipEditingContext(EODatabaseContext.java:2356)
... skipped 2 stack elements
at
com.webobjects.eocontrol.EOObjectStoreCoordinator.initializeObject(EOObjectStoreCoordinator.java:597)
at
com.webobjects.eocontrol.EOEditingContext.initializeObject(EOEditingContext.java:3768)
at er.extensions.eof.ERXEC.initializeObject(ERXEC.java:1141)
... skipped 3 stack elements
at
com.webobjects.eocontrol.EOObjectStoreCoordinator.objectsWithFetchSpecification(EOObjectStoreCoordinator.java:488)
at
com.webobjects.eocontrol.EOEditingContext.objectsWithFetchSpecification(EOEditingContext.java:4069)
at er.extensions.eof.ERXEC.objectsWithFetchSpecification(ERXEC.java:1206)
at
com.webobjects.eocontrol.EOEditingContext.objectsWithFetchSpecification(EOEditingContext.java:4444)
at com.mpv.mapload.Handler.loadingContextWillLoadObject(Handler.java:312)
at com.mpv.mapload.LoadingContext.willLoadObject(LoadingContext.java:930)
at com.mpv.mapload.LoadingContext.load(LoadingContext.java:737)
at com.mpv.agent.loaderagent.LoaderAgent.performWork(LoaderAgent.java:154)
at com.mpv.agent.MPVAgent._performWork(MPVAgent.java:310)
at com.mpv.agent.MPVAgent$MPVAgentTask._run(MPVAgent.java:198)
at er.extensions.concurrency.ERXTimerTask.run(ERXTimerTask.java:25)
at java.util.TimerThread.mainLoop(Timer.java:512)
at java.util.TimerThread.run(Timer.java:462)
Here is the code that adds the cache to the entity.
public static class Util<T extends UserGroup> extends _UserGroup.Util<T> {
/**
* UserGroup are static and stored in a lookup table. We use a cache
* to provide quick access to them. The cache is keyed by the userGroupID
* property.
*/
ERXEnterpriseObjectCache<T> _userGroupIDCache = new ERXEnterpriseObjectCache<T>(
UserGroup.ENTITY_NAME, UserGroup.USER_GROUP_ID_KEY);
/**
* Returns the UserGroup instance whose userGroupID property is equal to
<code>value</code>.
* The UserGroup is localized into the provided editing context.
*
* @param ec
* editing context in which the returned UserGroup instance is to live
* @param value
* UserGroup that is sought
* @return the UserGroup instance whose userGroupID property matches
<code>userGroupID</code>
*/
public T findUserGroupForUserGroupID(EOEditingContext ec, Integer value) {
return _userGroupIDCache.objectForKey(ec, value);
}
}
JR
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list ([email protected])
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com
This email sent to [email protected]