EJB3.x: 关于@UniqueConstraint标记无效(不起作用)问题

10 篇文章 0 订阅

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论
com.bes.enterprise.appserv.deployment.exception.StartupFailedException: Exception occurred while starting the application. at com.bes.enterprise.appserv.deployment.manager.AppDeployManager$2.run(AppDeployManager.java:253) at com.bes.enterprise.appserv.deployment.manager.AppDeployManager.applyDeploymentContext(AppDeployManager.java:297) at com.bes.enterprise.appserv.deployment.manager.AppDeployManager.doLoad(AppDeployManager.java:245) at com.bes.enterprise.appserv.deployment.manager.ApplicationLifecycle.load(ApplicationLifecycle.java:77) at com.bes.enterprise.appserv.deployment.AppDeployer.load(AppDeployer.java:264) at com.bes.enterprise.appserv.deployment.handler.EnableApplicationHandler.doLoad(EnableApplicationHandler.java:133) at com.bes.enterprise.appserv.deployment.handler.EnableApplicationHandler.load(EnableApplicationHandler.java:71) at com.bes.enterprise.appserv.deployment.handler.EnableApplicationHandler.doApplicationProcess(EnableApplicationHandler.java:54) at com.bes.enterprise.appserv.deployment.handler.AbstractApplicationHandler$1.call(AbstractApplicationHandler.java:69) at com.bes.enterprise.appserv.deployment.handler.AbstractApplicationHandler$1.call(AbstractApplicationHandler.java:66) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:750) at com.bes.enterprise.appserv.deployment.handler.AbstractApplicationHandler$TerminableThread.run(AbstractApplicationHandler.java:177) Caused by: com.bes.enterprise.ejb.BESException: Creating application failed: /besweb/webapp/prpall: ContainerBase.addChild: start: com.bes.enterprise.webtier.LifecycleException: Failed to start component [WebEngine[com.bes.appserv].VirtualHost[server].DefaultContext[/prpall]] at com.bes.enterprise.ejb.assembler.classic.assemblercontext.ApplicationDeployer.doCreateApplication(ApplicationDeployer.java:458) at com.bes.enterprise.ejb.assembler.classic.assemblercontext.ApplicationDeployer.createApplication(ApplicationDeployer.java:342) at com.bes.enterprise.ejb.assembler.classic.assemblercontext.ApplicationDeployer.createApplication(ApplicationDeployer.java:331) at com.bes.enterprise.ejb.assembler.classic.Assembler.createApplication(Assembler.java:258) at com.bes.enterprise.appserv.deployment.manager.AppDeployManager$2.run(AppDeployManager.java:251) ... 14 more Caused by: java.lang.IllegalStateException: ContainerBase.addChild: start: com.bes.enterprise.webtier.LifecycleException: Failed to start component [WebEngine[com.bes.appserv].VirtualHost[server].DefaultContext[/prpall]] at com.bes.enterprise.webtier.core.ContainerBase.addChildInternal(ContainerBase.java:745) at com.bes.enterprise.webtier.core.ContainerBase.addChild(ContainerBase.java:717) at com.bes.enterprise.webtier.core.DefaultHost.addChild(DefaultHost.java:711) at com.bes.enterprise.webext.BESWebAppBuilder.deployWebApps(BESWebAppBuilder.java:511) at com.bes.enterprise.ejb.assembler.classic.assemblercontext.ApplicationDeployer.deployWebApps(ApplicationDeployer.java:1499) at com.bes.enterprise.ejb.assembler.classic.assemblercontext.ApplicationDeployer.doCreateApplication(ApplicationDeployer.java:437) ... 18 more
最新发布
07-25

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

yexianyi

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值