数据库实体定义中创建视图

在实体定义中一般要定义视图,因为用delegator做查询时只能是单表查询,设计多表查询的时候就要建立视图。
视图定义代码:
<view-entity entity-name="GroupEmailView"
		package-name="org.ofbiz.call" title="call View Entity"
		copyright="Copyright (c) 2005 unisun" author="Jay">
		<member-entity entity-alias="EM" entity-name="Email" />
		<member-entity entity-alias="PR" entity-name="Person" />
		<member-entity entity-alias="AG" entity-name="AccountGroup" />

		<alias entity-alias="EM" name="title" />
		<alias entity-alias="EM" name="emailId" />
		<alias entity-alias="EM" name="sentDate" />
		<alias entity-alias="EM" name="accountOrContact" />
		<alias entity-alias="EM" name="mailTo" />
		<alias entity-alias="EM" name="mailCcTo" />
		<alias entity-alias="EM" name="mailFrom" />


		<alias entity-alias="AG" name="groupName" />

		<alias entity-alias="PR" name="firstName" />
		<alias entity-alias="PR" name="lastName" />

		<view-link entity-alias="EM" rel-entity-alias="AG">
			<key-map field-name="groupId" rel-field-name="groupId" />
		</view-link>
		<view-link entity-alias="EM" rel-entity-alias="PR">
			<key-map field-name="createBy" rel-field-name="partyId" />
		</view-link>
	</view-entity>

你可能感兴趣的:(xml)