Foros de discusión
Caching an entity on server startup
Florencia Gadea, modificado hace 11 años.
Caching an entity on server startup
Regular Member Mensajes: 146 Fecha de incorporación: 27/03/12 Mensajes recientes
Hi Everyone!
I'm not sure how Liferay cache system works. I'm developing a portlet, and I created an entity. I would like this entity to be cached on server startup.
How can I do this?
I'm using Liferay 6.1.1 GA 2.
Thanks,
Flor.
I'm not sure how Liferay cache system works. I'm developing a portlet, and I created an entity. I would like this entity to be cached on server startup.
How can I do this?
I'm using Liferay 6.1.1 GA 2.
Thanks,
Flor.
David H Nebinger, modificado hace 11 años.
RE: Caching an entity on server startup
Liferay Legend Mensajes: 14919 Fecha de incorporación: 2/09/06 Mensajes recientes
A service builder entity?
If so, you could override XxxLocalServiceImpl's afterPropertiesSet() method to fetch the entity after the object's been created. Be sure to call the superclass method, though...
If so, you could override XxxLocalServiceImpl's afterPropertiesSet() method to fetch the entity after the object's been created. Be sure to call the superclass method, though...
Florencia Gadea, modificado hace 11 años.
RE: Caching an entity on server startup
Regular Member Mensajes: 146 Fecha de incorporación: 27/03/12 Mensajes recientes
Hi David,
Thanks for your answer.
Yes, it is a service builder entitiy.
So you think that something like this would work?
Regards,
Flor.
Thanks for your answer.
Yes, it is a service builder entitiy.
So you think that something like this would work?
@Override
public void afterPropertiesSet() {
PersistedModelLocalServiceRegistryUtil.register("com.rcs.service.model.MessageSource", messageSourceLocalService);
try {
messageSourcePersistence.findAll();
} catch(SystemException e) {
}
}
Regards,
Flor.