简体   繁体   English

EJB项目使用哪种技术

[英]Which technology to use with EJB project

I'm developing java enterprise web application using EJB 3.1 and I wonder which technology to use on which MVC layer. 我正在使用EJB 3.1开发Java企业Web应用程序,我想知道在哪个MVC层上使用哪种技术。 I have ear, ejb(jar) and war projects. 我有耳朵,ejb(jar)和战争项目。

  1. Is it possible to use something other as persistence layer then JPA implementations (eg myBatis) and how? 是否可以将其他东西用作持久层,然后再使用JPA实现(例如myBatis),又如何? I would like to manage some more difficult queries on my own. 我想自己管理一些更困难的查询。

  2. What framework to use in web project (war) except JSF or plain servlets? 除了JSF或普通Servlet,在Web项目(战争)中使用什么框架?

  3. I'm familiar with Spring, would it be possible to use Spring in web (war) projects and benefit from its controllers? 我熟悉Spring,是否可以在Web(战争)项目中使用Spring并从其控制器中受益?

Can you explain which technologies are used to develop enterprise web applications? 您能否解释一下用于开发企业Web应用程序的技术?

Thanks. 谢谢。

The best combination would be to use what's already there. 最好的组合是使用已经存在的东西。 JSF 2.0 is already one of the best MVC frameworks, so it would often be a first choice anyway. JSF 2.0已经是最好的MVC框架之一,因此无论如何它通常都是首选。

When using EJB 3.1, this is almost always in combination with a Java EE implementation, so in that case JSF is already there and simply using it is a no-brainer. 当使用EJB 3.1时,几乎总是将它与Java EE实现结合使用,因此在这种情况下,JSF已经存在,只需使用它就可以了。

The different technologies in the Java EE stack are made to work with each other, so a typical stack consisting of JSF + CDI + EJB + JPA is the most ideal combination and you'll find the most support for this. Java EE堆栈中的不同技术可以相互配合使用,因此,由JSF + CDI + EJB + JPA组成的典型堆栈是最理想的组合,您将找到对此的最大支持。

I personally don't think there's any place for Spring in an EJB/CDI stack. 我个人认为Spring在EJB / CDI堆栈中没有任何地方。 Those two technologies are direct competitors that solve the same problem in (slightly) different ways. 这两种技术是直接竞争对手,可以(略)不同的方式解决相同的问题。 Combining them will most likely only complicate your code. 组合它们很可能只会使您的代码复杂化。

For a starter like you, stick with what comes out of the box with Java EE 5/6. 对于像您这样的初学者,请坚持使用Java EE 5/6随附的功能。 So in your case JSF+Facelets, EJB 3.1 and JPA. 因此,在您的情况下,JSF + Facelets,EJB 3.1和JPA。

I suggest you to read the below books and in the order given 我建议您按照给定的顺序阅读以下书籍

  1. Beginning Java™ EE 6 Platform with GlassFish™ 3 使用GlassFish™3开始Java™EE 6平台
  2. Real World Java EE Patterns Rethinking Best Practices 现实世界中的Java EE模式反思最佳实践

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM