如何引用外部JPA/JAXB域模型项目?

发布于 2025-01-04 13:11:38 字数 353 浏览 3 评论 0原文

我目前正在开发一个客户端/服务器应用程序,其中服务器由 RESTful 接口 (jersey) 组成,客户端是 JSF 应用程序。两者都在 glassfish 3.1.1 服务器上运行。为了保留一些数据并生成 XML 输出,我创建了一个带有 JAXB 和 JPA (eclipselink) 注释的域模型。一切都很好,只要域类位于服务器项目内即可。 但我想在外部项目中定义域模型,以便客户端(xml -> 对象)和 REST 服务器(对象 -> xml)可以通过引用其 *.jar 来使用它。 我已经实现了 JPA 在服务器上正常工作,但 JAXB 功能已被“删除”。

我对 Java EE 堆栈非常陌生。也许我打包的方式错误。如果有人能给我提示,我会很高兴:-)

I am developing a client/server application currently, where the server consists of a RESTful interface (jersey) and the client is a JSF application. Both are running on a glassfish 3.1.1 server. To persist some data and produce XML output I created a domain model with JAXB and JPA (eclipselink) annotations. Everything is fine, as long as the domain classes are within the server project.
But I want to define the domain model in an external project, so that it can be used by the client (xml -> object) and the REST server (object -> xml) by referencing its *.jar.
I alread achieved, that the JPA works correctly on the server, but the JAXB functionality has been "removed".

I am very new to the Java EE stack.. maybe I am packaging in a wrong way. Would be very happy, if someone could give me a hint :-)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

御守 2025-01-11 13:11:38

好的,在设置以下项目方面后它就起作用了:

  • Java
  • JAXB
  • JPA
  • Utility Module

之后:添加到构建路径并设置项目引用...

Ok, it worked after setting the following project facets:

  • Java
  • JAXB
  • JPA
  • Uitility Module

After that: adding to build path and setting a project reference...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文