EJB3.x异常:Unsuccessful: alter table ORDER add constraint FK47F8F2EFC558D0A foreign key (ORDER_USR_ID) references CUSTOMER

来源:互联网 发布:搜狗音乐软件 编辑:程序博客网 时间:2024/06/11 13:12

EJB3.x异常:Unsuccessful: alter table ORDER add constraint FK47F8F2EFC558D0A foreign key (ORDER_USR_ID) references CUSTOMER

在部署Order Entity Bean时,总是出现以下异常,久思不得其解:

16:57:05,453 ERROR [SchemaUpdate] Unsuccessful: alter table ORDER add constraint FK47F8F2EFC558D0A foreign key (ORDER_USR_ID) references CUSTOMER
16:57:05,453 ERROR [SchemaUpdate] 在关键字 'ORDER' 附近有语法错误。

16:57:05,453 INFO  [SchemaUpdate] schema update complete
16:57:05,453 INFO  [NamingHelper] JNDI InitialContext properties:{java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory, java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces}
16:57:05,703 INFO  [SessionSpecContainer] Starting jboss.j2ee:jar=EJBBookStoreEJBModule.jar,name=RoleDAOBean,service=EJB3
16:57:05,703 INFO  [EJBContainer] STARTED EJB: net.model.dao.bean.RoleDAOBean ejbName: RoleDAOBean
16:57:05,750 INFO  [SessionSpecContainer] Starting jboss.j2ee:jar=EJBBookStoreEJBModule.jar,name=CustomerDAOBean,service=EJB3
16:57:05,765 INFO  [EJBContainer] STARTED EJB: net.model.dao.bean.CustomerDAOBean ejbName: CustomerDAOBean
16:57:05,843 INFO  [JndiSessionRegistrarBase] Binding the following Entries in Global JNDI:

 CustomerDAOBean/remote - EJB3.x Default Remote Business Interface
 CustomerDAOBean/remote-net.model.dao.CustomerDAORemote - EJB3.x Remote Business Interface

16:57:05,875 INFO  [JndiSessionRegistrarBase] Binding the following Entries in Global JNDI:

 RoleDAOBean/remote - EJB3.x Default Remote Business Interface
 RoleDAOBean/remote-net.model.dao.RoleDAORemote - EJB3.x Remote Business Interface

最终,知道了原因。是因为我把Order类的Table名称映射成了ORDER,该词在MSSQL2000中是数据库的关键字,因此不能正常生成该表。

原创粉丝点击