良好的Java项目架构与数据库

发布于 2024-09-19 19:59:39 字数 165 浏览 4 评论 0原文

我在使用struts的项目中遇到数据库连接问题。我无法理解我如何管理我的数据库连接。我希望我的网站能够良好地基于访问,因为它在启动后将获得数百万美元。

并且还面临堆大小问题。

我不明白我将如何管理我的架构。 如果有人有知识,请指导我。 我想要良好的java架构和良好的数据库连接管理。

I facing problem of database connection in my project in which i used struts. I cant understand that how i manage my database connections. I want my site good in based on accessing becoz it will get million after launch.

And also face heap size problem in that .

I cant understand that how i will manage my architechture.
Plz guide me,if some one have the knowledge .
I want good java architecture with good management of database connection.

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

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

发布评论

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

评论(3

奢望 2024-09-26 19:59:39

我建议您使用 Hibernate 进行数据库操作。
这是非常好的 ORM 工具

对于您的架构案例来说,至少应该有 3 个模块。

1)网络应用
2)服务模块
3)数据库【Hibernate模块】

I would suggest you to use Hibernate for DB operation.
It is very good ORM tool

There should be 3 modules atleast for your case of architecture.

1)WebApp
2)Service module
3)Database [Hibernate Module]

我只土不豪 2024-09-26 19:59:39

Spring 有一些非常好的工具来帮助您管理数据库连接。查看文档的第四部分: http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/spring-data-tier.html

Spring可以帮助你,无论你想要什么执行简单的 JDBC / SQL 或者如果您想使用更奇特的 ORM(如 Hibernate)。

如果您想承受非常高的负载,那当然只是开始。您将需要大量的分析、测量、调整......

Spring has some very good facilities to help you manage DB connections. Have a look at part IV of the documentation : http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/spring-data-tier.html

Spring can help you wether you want to do plain JDBC / SQL or if you want to use a more fancy ORM like Hibernate.

If you want to sustain really high load, that's of course just the begining. You will need a lot of profiling, measuring, tweaking ...

爱,才寂寞 2024-09-26 19:59:39

您可以查看分层架构方法。 Struts 本身是基于MVC 架构模式的。

来自 Wiki,...在 MVC 中:

模型不是数据访问对象;但是,在几乎没有域逻辑的非常简单的应用程序中,没有真正的区别。

许多应用程序使用持久存储机制(例如数据库)来存储数据。 MVC 没有具体提及数据访问层,因为它被理解为位于模型之下或由模型封装。

因此,您可以提出自己的数据访问层,该层可以在您的模型下工作;查看使用 Hibernate 的简单数据访问层

You can look into the layered architecture approach. Struts itself is based upon the MVC architectural pattern.

From Wiki, ...In MVC:

Models are not data access objects; however, in very simple apps that have little domain logic there is no real distinction to be made.

Many applications use a persistent storage mechanism such as a database to store data. MVC does not specifically mention the data access layer because it is understood to be underneath or encapsulated by the model.

So, you can comeup with you own data access layer that would work underneath your Model; Checkout A Simple Data Access Layer using Hibernate

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