为什么不能我的耳朵项目看到我的JPA项目注释的EJB和实体? [英] why can't my EAR project see the annotated EJBs and Entities in my JPA project?

查看:187
本文介绍了为什么不能我的耳朵项目看到我的JPA项目注释的EJB和实体?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是IBM RAD 7(又名的Eclipse 3.4)和WebSphere 7。

I'm using IBM RAD 7 (aka Eclipse 3.4) and WebSphere 7.

我有一个基本的EJB设置一个工作区;项目TestEAR,TestEJB,TestJPA,TestWeb。

I have a workspace with a basic EJB setup; projects TestEAR, TestEJB, TestJPA, TestWeb.

我可以标注在TestEJB项目一个EJB(@Stateless EntityService),并能正常工作。但是,如果我在TestJPA项目投产一个EJB(@Stateless EntityDAO),它不会注入在EntityService。如果我移动EntityDAO到TestEJB项目正常工作。

I can annotate an ejb ("@Stateless EntityService") in the TestEJB project and it works fine. But if I put an ejb ("@Stateless EntityDAO") in the TestJPA project it doesn't get injected in the EntityService. If I move EntityDAO to the TestEJB project it works fine.

另外,如果我注释一个类的实体(@实体myEntity所),它是不知道作为一个实体的容器(我得到一个不承认实体......已知的实体类型:[]错误)。但是,如果我一个my.domain.MyEntity标签添加到TestEJB的persistence.xml它工作正常。

Also, if I annotate a class an entity ("@Entity MyEntity") it is not known as an entity to the container (I get a "not recognized entity" ... "Known entity types: []" error). But if I add a my.domain.MyEntity tag to the TestEJB's persistence.xml it works fine.

问:为什么不能TestEJB项目识别的TestJPA项目注释类

QUESTION: Why can't the TestEJB project recognize annotated classes in the TestJPA project?

注:没有在Eclipse 3.4没有部署大会标签,但有一个的Java EE模块依赖关系选项卡(TestEAR>属性> Java EE的模块依赖);我检查,所有项目都在列表中,选中(即TestEJB,TestJPA,TestWeb)。

NOTE: There is no "Deployment Assembly" tab in Eclipse 3.4, but there is a "Java EE Module Dependencies" tab (TestEAR > Properties > Java EE Module Dependencies); I checked and all projects are in the list and checked (ie. TestEJB, TestJPA, TestWeb).

任何帮助是极大AP preciated!这其中有我真正难住了。

Any help is greatly appreciated! This one has me truly stumped.

谢谢,
罗布

推荐答案

似乎有一些问题在这里...

Seems there are a few questions here...

有关您的TestEJB项目中不使用TestJPA豆确保两个被列为< EJB> 模块,而不是<罐子> 模块中TestEAR中的应用程序文件。另外,还要确保它们是EAR的两个组成部分。

For your TestEJB project not using TestJPA beans make sure both are listed as an <ejb> module and not <jar> module in your application.xml file in TestEAR. Also make sure they are both part of the EAR.

对于没有已知的实体类型如果误差在RSA出现,你可能想右击项目,并寻找JPA工具,然后选择配置JPA实体,如果你不看JPA工具保证JPA小面为该项目启用。如果是在服务器上发生的(是我presume),请确保以下行是不是在你的persistence.xml &LT;排除,非上市类&GT;真&LT; /排除-未列名类&GT; 或所有类都需要在其中上市,未必是一件坏事。

For the No Known Entity types if that error is appearing within RSA you might want to right click on the project and look for "JPA Tools" and select "Configure JPA entities", if you do not see "JPA Tools" ensure JPA facets are enabled for that project. If it is occuring on the server (WAS I presume) make sure the following line is not in your persistence.xml <exclude-unlisted-classes>true</exclude-unlisted-classes> or all classes will need to be listed therein, not necessarily a bad thing.

除非是绝对关键的我会存储您的EJB和实体为简单起见,同一个项目。

Unless it is absolutely critical I would store your EJBs and Entities in the same project for simplicity.

这篇关于为什么不能我的耳朵项目看到我的JPA项目注释的EJB和实体?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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