简体   繁体   English

我可以使用springsmvc + ejb + hibernate进行分布式应用程序吗?

[英]can i use springsmvc + ejb + hibernate for distributed application?

can i use the combination of springs mvc + EJB + Hibernate for my application. 我可以在我的应用程序中使用springs mvc + EJB + Hibernate的组合吗? My application is a distributed application. 我的应用程序是分布式应用程序。 So is this combination suitable for my application? 那么这种组合适合我的应用吗?


I want to develop an distributed application and have started the gui coding using springs-mvc 我想开发一个分布式应用程序,并已开始使用springs-mvc进行gui编码
and now I want to access the database and I'am confused weather to use jdbc or hibernate? 现在我想访问数据库,我感到困惑的是要使用jdbc还是休眠?

I read somewhere that hibernate is not suitable for distributed applications. 我读到某处休眠不适合分布式应用程序的地方。 So can anyone please help me in deciding weather to use jdbc or hibernate? 所以有人可以帮助我确定使用jdbc还是休眠的天气吗?

thank you in advance. 先感谢您。

TL;TR: Yes you can. TL; TR:是的,您可以。

Long Version: 长版:

JDBC vs JPA (or Hibernate) : JPA/Hibernate tends to be the way to go if you need a Object Oriented version of your domain ( in general it's something good). JDBC vs JPA(或Hibernate) :如果您需要域的面向对象版本( 通常很好),则JPA / Hibernate往往是首选的方法。 JDBC is more used for performance tasks (batch), or a simple query tools (even for legacy systems). JDBC被更多地用于性能任务(批处理)或简单的查询工具(甚至用于旧系统)。

SpringMVC vs JSF : JSF is used when you prefer to use a component library (eg: primefaces), SpringMVC tends to be used when you want full control of your Javascript+CSS+HTML. SpringMVC vs JSF :当您更喜欢使用组件库(例如,primefaces)时,可以使用JSF;而当您想完全控制Javascript + CSS + HTML时,则倾向于使用SpringMVC。 As you already know, JSF is an abstraction that avoids dealing with web technologies as much as possible. 如您所知,JSF是一种抽象,它尽可能避免使用Web技术。 Neither is better than the other, just different 两者都不比对方更好,只是有所不同

Spring Framework vs EJB/CDI : Matter of preferences, they almost offer same as the other, the programming model is almost the same, keep in mind that some Spring characteristics are exclusive (Vendor Lock ahead!), and to some extent (my biased opinion) EJB+CDI is more elegant and simple. Spring Framework与EJB / CDI :偏好方面,它们几乎彼此提供相同的内容,编程模型几乎相同,请记住,某些Spring特性是排他的(前面是Vendor Lock!),并且在某种程度上(我有偏见)意见)EJB + CDI更优雅,更简单。

Alternative solution: If you are familiar with SpringMVC, so go with it, you can even use it in a Java EE server 替代解决方案:如果您熟悉SpringMVC,请继续使用它,甚至可以在Java EE服务器中使用它。

Warning: Don't use the old buggy way tomcat + zillions of jars , if you go with Java EE use at least TomEE, if you prefer Spring, use the tc Server. 警告:不要使用过时的tomcat +大量jar的越野车方式,如果您使用Java EE,请至少使用TomEE,如果您更喜欢Spring,请使用tc Server。

Note: App servers right now are not heavy weight (see also: TomEE, wildfly). 注意:现在的应用服务器并不繁重(另请参见:TomEE,wildfly)。

EDIT: 编辑:

For "distributed" systems you can use JMS or Webservices (there are other techniques but not as mainstream). 对于“分布式”系统,您可以使用JMS或Web服务(还有其他技术,但不是主流)。

The web-services way it's simpler to achieve with EJB (@Webservice or @Path annotations), you can go with JMS but it's a little bit harder to maintain and monitor, also, maybe you will need to acknowledge some clients and you need to deal with the inherited asynchronous of JMS, go with JMS Only-when-necessary . 使用EJB(@Webservice或@Path批注)可以更轻松地实现Web服务,您可以使用JMS,但是维护和监视起来有点困难,而且,也许您需要确认某些客户端,并且需要处理JMS的继承异步,请使用JMS Only-when-necessary

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

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