Foros de discusión
How to use reference in service builder in custom portlet?
delang j, modificado hace 7 años.
How to use reference in service builder in custom portlet?
Expert Mensajes: 252 Fecha de incorporación: 14/07/08 Mensajes recientes
hi guys, as per subject, do you have any idea how to use reference in custom portlet and how reference works.
like 'user' & 'contact' found in portal service.xml.
thanks
regrds,
delang
like 'user' & 'contact' found in portal service.xml.
thanks
regrds,
delang
David H Nebinger, modificado hace 7 años.
RE: How to user reference in service builder in custom portlet?
Liferay Legend Mensajes: 14919 Fecha de incorporación: 2/09/06 Mensajes recientes
delang j, modificado hace 7 años.
RE: How to user reference in service builder in custom portlet?
Expert Mensajes: 252 Fecha de incorporación: 14/07/08 Mensajes recientes
thank you for your response,
i read that but somehow couldnt understand how to implement it.
maybe some example/sample portlet.
thank you
i read that but somehow couldnt understand how to implement it.
maybe some example/sample portlet.
thank you
delang j, modificado hace 6 años.
RE: How to user reference in service builder in custom portlet?
Expert Mensajes: 252 Fecha de incorporación: 14/07/08 Mensajes recientes
my goal is to achieve something like this.
in custom service builder portlet.
tq
UserLocalServiceUtil.getUser(userId).getContact().getBirthday();
in custom service builder portlet.
tq
David H Nebinger, modificado hace 6 años.
RE: How to use reference in service builder in custom portlet?
Liferay Legend Mensajes: 14919 Fecha de incorporación: 2/09/06 Mensajes recientes
Like the comment says, if you include a reference to the User entity, then SB will inject the UserLocalService into your XxxLocalServiceImpl. You'll be able to access it directly rather than going through the static utils.
Same kind of thing if you add a reference to the Contact entity, you'll get the ContactLocalService injected into your XxxLocalServiceImpl class.
There's no magic, there's no portlet even. You will just get the referenced services injected and you can use them in your XxxLocalServiceImpl to fetch the data from these other entities.
Same kind of thing if you add a reference to the Contact entity, you'll get the ContactLocalService injected into your XxxLocalServiceImpl class.
There's no magic, there's no portlet even. You will just get the referenced services injected and you can use them in your XxxLocalServiceImpl to fetch the data from these other entities.
delang j, modificado hace 6 años.
RE: How to use reference in service builder in custom portlet?
Expert Mensajes: 252 Fecha de incorporación: 14/07/08 Mensajes recientes
thank you for your great explanation.
im not sure that im missed something or not, an error occurred before disappear after modified service.xml
below are service.xml
please advice.
im not sure that im missed something or not, an error occurred before disappear after modified service.xml
below are service.xml
<entity name="Student" table="student" local-service="true" remote-service="false">
<column name="studentId" type="long" primary="true" id-type="increment" />
<column name="name" type="String" />
<column name="addressId" type="String" />
<column name="createdDate" type="Date" />
<column name="modDate" type="Date" />
<reference entity="Address" package-path="com.liferay.testsb" />
</entity>
<entity name="Address" table="address" local-service="true" remote-service="false">
<column name="addressId" type="long" primary="true" id-type="increment" />
<column name="street1" type="String" />
<column name="street2" type="String" />
<column name="street1" type="String" />
<column name="city" type="String" />
<column name="createdDate" type="Date" />
<column name="modDate" type="Date" />
</entity>
please advice.
David H Nebinger, modificado hace 6 años.
RE: How to use reference in service builder in custom portlet?
Liferay Legend Mensajes: 14919 Fecha de incorporación: 2/09/06 Mensajes recientes
You only use reference for entities from a different service.xml, not entities in the same service.xml file.
Sushil Patidar, modificado hace 6 años.
RE: How to use reference in service builder in custom portlet?
Expert Mensajes: 467 Fecha de incorporación: 31/10/11 Mensajes recientes
Hi,
Address entity reference should be directly available as this entity is generated in the same module so i think you don't need to refer them in the same service builder.
Regards
Address entity reference should be directly available as this entity is generated in the same module so i think you don't need to refer them in the same service builder.
Regards
Sushil Patidar, modificado hace 6 años.