Spring, Hibernate, Java EE in the 3 Tier architecture

筅森魡賤 提交于 2019-12-03 10:48:25

问题


I need to get a start as to where I put those technologies in the 3 Tier architecture: This is what I have...

  • presentation layer: HTML, JSP

  • app. layer: Java EE, Spring

  • data access layer: Hibernate, PostgreSQL database


回答1:


Yes, I would put Hibernate in the data access layer. In fact the 3rd layer is the "Data layer" and not the data access layer, maybe this confuses you. So everything that's business logic related goes into the app (or business) layer.




回答2:


You are mixing Tier and Layer which makes things pretty confusing, especially for yourself! If your question is about layers, then ask a question about layers.

Anyway, let me try to clarify...

In a Three Tier architecture, the Tiers consist of:

  • the Client Tier (or Presentation Tier),
  • the Business Tier (or Middle Tier or Logic Tier or Application Tier, etc),
  • the Enterprise Information Systems (EIS) Tier (or Data Tier).

And here are the typical layers of a multi layered application:

  • the Presentation Layer: Servlet/JSP
  • the Service Layer: Spring Services + Spring Transactions or EJB Session Beans
  • the Domain Layer: POJOs
  • the Data Access Layer: Hibernate/JPA
  • the Physical Layer: Database, LDAP, file system, etc.

Hibernate would be part of the Data Access Layer (but PostgreSQL is part of the Physical Layer).

The Presentation, Service, Domain, Data Access Layers map to the Business Tier. The Physical Layer maps to the Data Tier.




回答3:


If you want to use Spring MVC, it will most likely live in the presentation tier.



来源:https://stackoverflow.com/questions/3434121/spring-hibernate-java-ee-in-the-3-tier-architecture

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!