Foros de discusión
Inject persistence service into my service class
Ben Longi, modificado hace 12 años.
Inject persistence service into my service class
New Member Mensajes: 17 Fecha de incorporación: 17/11/11 Mensajes recientes
Hello,
I'm writing an hook to change JournalArticle behaviour.
My service class extends JournalArticleLocalServiceWrapper and I'm overiding getDisplayArticle(long groupId, String articleId) method.
In this method I need to make a call to the database using the JournalArticlePersistence class.
However that object is null in my service context. I tried to inject the bean
I though it could work because my hook inherit the default liferay spring configuration. But actually It doesn't work.
How can I use a Liferay Persistence service in my own service class ? Should I use service builder ? I'd like to avoid service builder because my need is really simple here...
Thanks
I'm writing an hook to change JournalArticle behaviour.
My service class extends JournalArticleLocalServiceWrapper and I'm overiding getDisplayArticle(long groupId, String articleId) method.
In this method I need to make a call to the database using the JournalArticlePersistence class.
List<journalarticle> articles = journalArticlePersistence.findByG_A_ST(....)</journalarticle>
However that object is null in my service context. I tried to inject the bean
@BeanReference(type = JournalArticlePersistence.class)
protected JournalArticlePersistence journalArticlePersistence;
I though it could work because my hook inherit the default liferay spring configuration. But actually It doesn't work.
How can I use a Liferay Persistence service in my own service class ? Should I use service builder ? I'd like to avoid service builder because my need is really simple here...
Thanks