良好的Java项目架构与数据库
我在使用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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我建议您使用 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]
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 ...
您可以查看分层架构方法。 Struts 本身是基于MVC 架构模式的。
来自 Wiki,...在 MVC 中:
因此,您可以提出自己的数据访问层,该层可以在您的模型下工作;查看使用 Hibernate 的简单数据访问层
You can look into the layered architecture approach. Struts itself is based upon the MVC architectural pattern.
From Wiki, ...In MVC:
So, you can comeup with you own data access layer that would work underneath your Model; Checkout A Simple Data Access Layer using Hibernate