Foros de discusión

How to create tree database with Service Builder?

Milan Kostoláni, modificado hace 11 años.

How to create tree database with Service Builder?

Junior Member Mensajes: 92 Fecha de incorporación: 26/07/12 Mensajes recientes
Hi everyone,

Im trying to make tree database like this: there is an Order(parent), someone who made the order - Person, FoodOrder type of order with more parameters, Address - extends FoodOrder and Food that also extends FoodOrder

And I wonder how i do relationships(parent/child) between the entities?
thumbnail
Jignesh Vachhani, modificado hace 11 años.

RE: How to create tree database with Service Builder?

Liferay Master Mensajes: 803 Fecha de incorporación: 10/03/08 Mensajes recientes
There is one tag already available called reference in service.xml which is used to give reference for other table or entity.

you can see below sample code :


	<entity name="BlogsEntry" uuid="true" local-service="true" remote-service="true">

		<column name="entryId" type="long" primary="true" />
		<column name="groupId" type="long" />
		<column name="companyId" type="long" />
		<column name="userId" type="long" />
		<column name="userName" type="String" />
		<column name="createDate" type="Date" />
		<column name="modifiedDate" type="Date" />

		<!-- Order -->

		<order by="desc">
			<order-column name="displayDate" />
			<order-column name="createDate" />
		</order>

		<!-- Finder methods -->

		<finder name="GroupId" return-type="Collection">
			<finder-column name="groupId" />
		</finder>
		<finder name="CompanyId" return-type="Collection">
			<finder-column name="companyId" />
		</finder>

		<!-- References -->

		<reference package-path="com.liferay.portal" entity="Company" />
		<reference package-path="com.liferay.portal" entity="Group" />
		<reference package-path="com.liferay.portal" entity="Image" />
		<reference package-path="com.liferay.portal" entity="Organization" />
		<reference package-path="com.liferay.portal" entity="PortletPreferences" />
		<reference package-path="com.liferay.portal" entity="Subscription" />
		<reference package-path="com.liferay.portal" entity="WorkflowInstanceLink" />
		<reference package-path="com.liferay.portlet.asset" entity="AssetEntry" />
		<reference package-path="com.liferay.portlet.asset" entity="AssetLink" />
		<reference package-path="com.liferay.portlet.asset" entity="AssetTag" />
		<reference package-path="com.liferay.portlet.expando" entity="ExpandoValue" />
		<reference package-path="com.liferay.portlet.messageboards" entity="MBMessage" />
		<reference package-path="com.liferay.portlet.ratings" entity="RatingsStats" />
		<reference package-path="com.liferay.portlet.social" entity="SocialActivity" />
	</entity>
Milan Kostoláni, modificado hace 11 años.

RE: How to create tree database with Service Builder?

Junior Member Mensajes: 92 Fecha de incorporación: 26/07/12 Mensajes recientes
Ok, so its possible to inject, but is it possible to do something like this?

I want to have a one entity Registration and another SportRegistration, they are both in one portlet so there is just one server.xml.
Then Im not able to connect them, it is just only way to inject by reference?

Thanks for answering