开发者

Good Java project architecture with database

I facing problem of database connection in my project in which开发者_如何学JAVA 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.


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 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 ...


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜