这种数据库结果如何用hibernate实现?

lxf9501 2005-09-15 06:27:37
表一:plu : storeID,itemNumber是key
表二:ord : storeID,itemNumber,requestNumber是key
其中 前两个key可以关联
如何用hibernate来描述这个结构??
...全文
98 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
lxf9501 2005-09-19
  • 打赏
  • 举报
回复
如何写many-to-one等等的关联呢??
thriller75 2005-09-17
  • 打赏
  • 举报
回复
用comsite-id来表示。不过都不太推崇这种设计.

<composite-id name="comp_id" class="pK">
<meta attribute="class-description" inherit="false">
@hibernate.id
generator-class="assigned"
</meta>
<key-property
name="examId"
column="iExamId"
type="java.lang.Integer"
length="4"
>
<meta attribute="field-description">
@hibernate.property
column="iExamId"
length="4"
</meta>
</key-property>
<key-property
name="studentId"
column="iStudentId"
type="java.lang.Integer"
length="4"
>
<meta attribute="field-description">
@hibernate.property
column="iStudentId"
length="4"
</meta>
</key-property>
<key-property
name="courseId"
type="int"
column="iCourseId"

length="1" >
<meta attribute="field-description">
@hibernate.property
column="iCourseId"
length="1"

</meta>
</key-property>
</composite-id>

<property
name="gradeId"
type="int"
column="iGradeId"
not-null="true"
length="1"
>
<meta attribute="field-description">
@hibernate.property
column="iGradeId"
length="1"
not-null="true"
</meta>
</property>
<property
name="classid"
type="int"
column="iClassid"
not-null="true"
length="4"
>
<meta attribute="field-description">
@hibernate.property
column="iClassid"
length="4"
not-null="true"
</meta>
</property>
lxf9501 2005-09-16
  • 打赏
  • 举报
回复
哪位能帮帮忙???

67,513

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧