我有一个与Liferay Service Builder有关的问题。我想在创建的Join表中创建与自定义列的多对多关系。
这是我的service.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE service-builder PUBLIC "-//Liferay//DTD Service Builder 6.2.0//EN" "http://www.liferay.com/dtd/liferay-service-builder_6_2_0.dtd">
<service-builder package-path="de.mycompany.mm.services">
<author>rawdog</author>
<namespace>mycompany</namespace>
<entity name="Registration" local-service="true" remote-service="false">
<column name="RegID" type="long" primary="true"></column>
<column name="Email" type="String"></column>
<column name="Hash" type="String"></column>
<column name="Validate" type="boolean"></column>
<column name="NewsletterID" type="Collection" entity="Newsletter" mapping-table="Registration_Newsletter"/>
<finder name="Hash" return-type="Registration">
<finder-column name="Hash"></finder-column>
</finder>
</entity>
<entity name="Newsletter" local-service="true" remote-service="false">
<column name="NewsletterID" type="long" primary="true"></column>
<column name="Name" type="String"></column>
<column name="Status" type="boolean"></column>
<column name="RegID" type="Collection" entity="Registration" mapping-table="Registration_Newsletter"/>
</entity>
</service-builder>
这会自动创建以下SQL CREATE语句:
create table mycompany_Registration_Newsletter (
RegID LONG not null,
NewsletterID LONG not null,
primary key (ANID, MMID)
);
我怎么能在JOIN表中自动创建自定义列,如状态BOOLEAN 。它最终应该是这样的:
create table mycompany_Registration_Newsletter (
RegID LONG not null,
NewsletterID LONG not null,
Status BOOLEAN,
primary key (ANID, MMID)
);
感谢您的帮助。
答案 0 :(得分:0)
您有两种方法可以解决此问题:
ALTER TABLE yourJoinedTable ADD yourBooleanColumn BOOLEAN NOT NULL;
)手动修改连接表,然后在服务构建器中定义CUSTOM SQL / NATIVE QUERY以使用此连接表。