Service.xml

From Null-pointer

Jump to: navigation, search
<!DOCTYPE service-builder PUBLIC "-//Liferay//DTD Service Builder 5.0.0//EN"
 "http://www.liferay.com/dtd/liferay-service-builder_5_0_0.dtd">
<service-builder package-path="com.linhopesolutions.canopy">
	<namespace>Canopy</namespace>

	<entity name="Overview" local-service="true" remote-service="false">

	        <!--
		 Use a class to generate the primary key.
		-->
		<column name="overviewId" type="int" primary="true" id-type="class"
			id-param="com.liferay.counter.service.persistence.IDGenerator" />
		<column name="text" type="String" />
		<column name="published" type="boolean" />
		<column name="lastModifiedBy" type="long" />
		<column name="lastModifiedOn" type="Date" />
		<column name="userId" type="long" />

		<finder return-type="Collection" name="UserId">
			<finder-column name="userId" />
		</finder> 

		<reference package-path="com.liferay.portal.model" entity="User" />
	</entity>
</service-builder>

Primay key field

There are four ways to create the primary key:

  1. id-type="class" : You use a class to generate the primary, works for all situations
  2. id-type="increment" : Works for all databases supported but not in a clustered enviroment
  3. id-type="identity" : Works for DB2, MySQL, and MS SQL Server.
  4. id-type="id-type="sequence" id-param="id_sequence" : Works for DB2, Oracle, PostgreSQL, and SAP DB.

See also

Personal tools