我正在从 Liferay 7.2 移植到 Liferay 7.3.6 GA7。我有一个自定义表。当我使用 ..LocalServiceUtil 添加第一行时,没关系。但是以后每次我使用持久性(例如tablePersistence.update(table);)都会失败并且liferay会抛出:
错误 [http-nio-8080-exec-1][ExceptionMapper:31] java.lang.NullPointerException java.lang.NullPointerException at com.liferay.portal.cache.internal.dao.orm.FinderCacheImpl._getArguments(FinderCacheImpl.java: 466) 在 com.liferay.portal.cache.internal.dao.orm.FinderCacheImpl.updateByEntityCache(FinderCacheImpl.java:378) 在 com.liferay.portal.cache.internal.dao.orm.EntityCacheImpl._putResult(EntityCacheImpl.java: 439) 在 com.liferay.portal.cache.internal.dao.orm.EntityCacheImpl.putResult(EntityCacheImpl.java:336) 在 com.liferay.portal.cache.internal.dao.orm.EntityCacheImpl.putResult(EntityCacheImpl.java:第358章)在com.liferay.portal.cache.internal.dao.orm.EntityCacheImpl.putResult(EntityCacheImpl.java:328)
尝试执行 entityCache.putResult(entityCacheEnabled,...); 时,例外情况在 ..PersistenceImpl 中。我不明白我是否在移植过程中丢失了某些东西,或者是否在 7.3 中丢失了某些东西。
这是一个在 customTable 中添加行的方法的示例,并且fooPersistence.update(foo)在第一次之后抛出异常:
@Indexable(type = IndexableType.REINDEX)
public Foo add(ServiceContext serviceContext)
throws PortalException {
long companyId = serviceContext.getCompanyId();
long userId = serviceContext.getUserId();
User user = UserLocalServiceUtil.getUser(userId);
long groupId = user.getGroupId();
long id = counterLocalService.increment();
Foo foo = fooPersistence.create(id);
Date now = new Date();
foo.setCreateDate(now); foo.setCompanyId(companyId);
foo.setGroupId(groupId);
fooPersistence.update(foo);
return foo;
}