Seam App通过EJB访问数据

时间:2021-08-09 15:30:10

I have to investigate the possibility of using JBoss and Seam to build user interfaces to data held in a database controlled by an off-the-shelf package. I've been reading through some of the Seam documentation, and various other sources, but I can't seem to clear the confusion I'm currently suffering from.

我必须研究使用JBoss和Seam构建用户界面的可能性,这些用户界面保存在由现成的包控制的数据库中。我一直在阅读一些Seam文档和其他各种来源,但我似乎无法清除我目前正在遭受的困惑。

My problem is that everything I've read so far talks about using JPA/Hibernate to access and persist data directly in a database schema, but the package I'm working with doesn't allow (or actively discourages) direct updates to any schema that it controls. It does however present what looks like a comprehensive data-access API delivered as an EJB. With the basic assumption that it's entirely possible, my question is how would I go about building a Seam app that uses this EJB for all data access? Is it a simple thing or am I heading for a whole heap of pain? Can anyone point me in the direction of reading material that will help me?

我的问题是我到目前为止所阅读的所有内容都谈到使用JPA / Hibernate直接访问数据库模式并将数据直接保存在数据库模式中,但我正在使用的包不允许(或主动阻止)对任何模式的直接更新它控制着。然而,它确实提供了看起来像作为EJB提供的综合数据访问API。基本的假设是完全可能的,我的问题是如何构建一个使用这个EJB进行所有数据访问的Seam应用程序?这是一件简单的事情,还是我正在走向一大堆痛苦?任何人都可以指向我阅读有助于我的材料的方向吗?

Apologies in advance for the newbie nature of this question, but I've been dropped in at the deep end on this and I'm struggling to pick up so much new knowledge. Any help will be very gratefully received.

对这个问题的新手性质提前道歉,但我已经深入研究了这一点,我正在努力学习这么多新知识。非常感谢任何帮助。

Many thanks

Steve

1 个解决方案

#1


0  

Seam is mainly an inversion of control (IoC) container that provides a lot of boilerplate functionality for web development. It has no real hard requirements for you to use JPA/Hibernate. It's just that the most usual scenario for Java web development is a database backend that's mapped by an ORM, of which JPA/Hibernate is probably the de-facto standard.

Seam主要是一个控制反转(IoC)容器,它为Web开发提供了许多样板功能。使用JPA / Hibernate没有真正的硬性要求。只是Java Web开发最常见的场景是由ORM映射的数据库后端,其中JPA / Hibernate可能是事实上的标准。

If your data access layer (DAL) does not exist or is just wrapper around an existing API (web services, REST, etc.), Seam will also handle that scenario very easily and provide you with all its remaining functionality (session management, JSF integration, security, navigation flow management and lots more).

如果您的数据访问层(DAL)不存在或只是现有API(Web服务,REST等)的包装,Seam也将非常轻松地处理该场景并为您提供其所有剩余功能(会话管理,JSF)集成,安全,导航流程管理等等。

In essence, a simple component (or set of) that exposes the API you mention and handles its state should be enough. Then again, I do not know your requirements, so I can't say that for sure.

从本质上讲,暴露您提到的API并处理其状态的简单组件(或一组)就足够了。然后,我不知道你的要求,所以我不能肯定地说。

A more complex example is the Seam Social module in Seam 3. It uses Twitter, Facebook or other social web APIs to connect to those services and inject them into Seam's contexts', so that your application can leverage their functionality. I don't know if your scenario is so complex that it would require you to build an entire CDI module from scratch (as Seam Social does) but take a look at their documentation. It might give you some ideas on what further investigate.

一个更复杂的例子是Seam 3中的Seam Social模块。它使用Twitter,Facebook或其他社交Web API连接到这些服务并将它们注入到Seam的上下文中,以便您的应用程序可以利用它们的功能。我不知道你的场景是否如此复杂以至于它需要你从头开始构建一个完整的CDI模块(如Seam Social所做的那样),但是看看他们的文档。它可能会为您提供进一步调查的一些想法。

#1


0  

Seam is mainly an inversion of control (IoC) container that provides a lot of boilerplate functionality for web development. It has no real hard requirements for you to use JPA/Hibernate. It's just that the most usual scenario for Java web development is a database backend that's mapped by an ORM, of which JPA/Hibernate is probably the de-facto standard.

Seam主要是一个控制反转(IoC)容器,它为Web开发提供了许多样板功能。使用JPA / Hibernate没有真正的硬性要求。只是Java Web开发最常见的场景是由ORM映射的数据库后端,其中JPA / Hibernate可能是事实上的标准。

If your data access layer (DAL) does not exist or is just wrapper around an existing API (web services, REST, etc.), Seam will also handle that scenario very easily and provide you with all its remaining functionality (session management, JSF integration, security, navigation flow management and lots more).

如果您的数据访问层(DAL)不存在或只是现有API(Web服务,REST等)的包装,Seam也将非常轻松地处理该场景并为您提供其所有剩余功能(会话管理,JSF)集成,安全,导航流程管理等等。

In essence, a simple component (or set of) that exposes the API you mention and handles its state should be enough. Then again, I do not know your requirements, so I can't say that for sure.

从本质上讲,暴露您提到的API并处理其状态的简单组件(或一组)就足够了。然后,我不知道你的要求,所以我不能肯定地说。

A more complex example is the Seam Social module in Seam 3. It uses Twitter, Facebook or other social web APIs to connect to those services and inject them into Seam's contexts', so that your application can leverage their functionality. I don't know if your scenario is so complex that it would require you to build an entire CDI module from scratch (as Seam Social does) but take a look at their documentation. It might give you some ideas on what further investigate.

一个更复杂的例子是Seam 3中的Seam Social模块。它使用Twitter,Facebook或其他社交Web API连接到这些服务并将它们注入到Seam的上下文中,以便您的应用程序可以利用它们的功能。我不知道你的场景是否如此复杂以至于它需要你从头开始构建一个完整的CDI模块(如Seam Social所做的那样),但是看看他们的文档。它可能会为您提供进一步调查的一些想法。