【发布时间】:2014-05-30 05:23:24
【问题描述】:
我知道这个问题可能令人困惑,我会以任何方式解释它。
基本上我有两张桌子。 Student 和 Course,其中 studentid 和 courseid 是它们对应的主键。
在学生表中,我有两个属性 courseid 和 courseidbackup 都是课程表的键(FK)。 这是我正在使用的服务 xml,但它显示构建不成功。
我在这里缺少什么?如何创建服务 xml 来实现这一点?
<service-builder package-path="com.students.db">
<author>bugs</author>
<namespace>students</namespace>
<entity name="Student" local-service="true" remote-service="true" cache-enabled="false">
<column name="studentId" type="long" primary="true" />
<column name="studentName" type="String" />
<column name="coursesid" type="Collection" entity="Course" mapping-table="Students_Courses"/>
<column name="coursesidbackup" type="Collection" entity="Course" mapping-table="Students_Courses"/>
</entity>
<entity name="Course" local-service="true" remote-service="true" cache-enabled="false">
<column name="courseId" type="long" primary="true" />
<column name="courseName" type="String" />
<column name="courseDetails" type="String" />
<column name="students" type="Collection" entity="Student" mapping-table="Students_Courses" />
</entity>
</service-builder>
【问题讨论】:
-
AFAIK Liferay 服务构建器不提供外键支持
-
好的。还有其他建议吗?
-
您可以手动编写代码来处理与学生/课程实体的外键关系
-
那是在成功构建这个服务xml之后吧?
标签: liferay liferay-6 liferay-theme liferay-velocity liferay-aui