大魚

          EJB3.x: 關于@UniqueConstraint標記無效問題

          EJB3.x: 關于@UniqueConstraint標記無效問題

          在制定Entity Bean時,設置了該實體的@UniqueConstraint限制。但是對該實體Bean進行部署后,并沒有在數據庫表中看到對應表字段出現unique限制。這是因為@UniqueConstraint標記必須在自動生成表的情況下才起作用。即,在persistence.xml中將hibernate.hbm2ddl.auto設置為create-drop。否則,唯一性約束限制不會被加入到數據庫中。

          以下是《JSR 220: Enterprise JavaBeansTM,Version 3.0 Java Persistence API》文檔的原文說明:

          Type

          Name

          Description

          Default

          UniqueConstraint[]

          uniqueConstraints

          (Optional) Unique constraints that are to be placed on the table. These are only used if table generation is in effect. These constraints apply in addition to any constraints specified by the Column and JoinColumn annotations and constraints entailed by primary key mappings.

          No additional

          constraints

          posted on 2009-03-16 22:13 大魚 閱讀(268) 評論(0)  編輯  收藏 所屬分類: EJB

          主站蜘蛛池模板: 错那县| 通榆县| 永靖县| 青龙| 夹江县| 拜泉县| 汉源县| 民乐县| 三门峡市| 珲春市| 谷城县| 临澧县| 全州县| 玉林市| 福清市| 嘉荫县| 乌鲁木齐县| 肃北| 赤水市| 安康市| 岗巴县| 佛冈县| 泰顺县| 仁怀市| 英超| 新干县| 女性| 浙江省| 敖汉旗| 东明县| 鄯善县| 锡林浩特市| 灵山县| 武山县| 天长市| 龙江县| 禹城市| 石狮市| 海伦市| 莲花县| 吉林省|