在hibernate映射文件中指定约束名称 [英] specifying constraint name in hibernate mapping file

查看:98
本文介绍了在hibernate映射文件中指定约束名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



是否有一种方法可以在Hibernate映射文件中指定约束名称(来自外键,唯一约束等) )是否会被创建而不是(不是用户友好的)生成的?

解决方案

是的,最近版本的Hibernate至少3.5+)你可以使用@ForeignKey注解。



http://docs.jboss.org/hibernate/orm/3.5/api/org/hibernate/annotations/ForeignKey.html p>

I am using Hibernate 3 with Oracle 10.

Is there a way to specify in a Hibernate mapping file the constraint names (from foreign keys, unique constraints, etc) that will be created rather than the (not user-friendly) generated ones?

解决方案

Yes, with recent versions of Hibernate (at least 3.5+) you can use the @ForeignKey annotation.

http://docs.jboss.org/hibernate/orm/3.5/api/org/hibernate/annotations/ForeignKey.html

这篇关于在hibernate映射文件中指定约束名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆