• Post Reply Bookmark Topic Watch Topic
  • New Topic

What is DAO(Data Access Obect)?  RSS feed

 
Ranch Hand
Posts: 674
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there

I am making a web application using Spring+Hibernare combination.This is a very large web application.But I have heared like package classification should be like DAO classes in a separte package,View class should be in a seprate package and model class should be in seprate package.But I want to know How I decide which class should be placed where?

It will be very nice if working on MVC type project can answar this question what should be package structure and all?


Thanks in advance
 
Marshal
Posts: 56600
172
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't think we can tell you your package structure.
A data access object is one designed to contain lots of data and simply to store those data. At least I think so. Try in Wikipedia.
 
Kishor Joshi
Ranch Hand
Posts: 674
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@Campbell:

I am not asking for to much detail just 2 or 4 line answar in a nutshell(Which types of classes should be placed where),but with practical words.I have read that wikipedia
 
Sheriff
Posts: 11494
180
Android Debian Eclipse IDE IntelliJ IDE Java Linux Mac Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Kishor Joshi wrote:I am not asking for to much detail just 2 or 4 line answar in a nutshell(Which types of classes should be placed where),but with practical words.

When I organize packages, it's around considerations for deployment, reuse, and maintenance. Code that is deployed, reused, and maintained along the same lines go into the same package or groups of packages. DAOs, for example, are usually defined as interfaces with DB-specific implementations. If I need multiple applications to use the same DAOs, e.g. when one or more backend apps and a webapp access the same data, then I package the DAO interfaces and implementation classes in the same JAR file. That way, I can reuse, deploy, and maintain them as one large unit. If I need to update or add more DAOs, then I make my changes in one place and deploy the same build artifact to multiple applications.
 
Campbell Ritchie
Marshal
Posts: 56600
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Classes which manipulate the display should be in one package or one lot of packages. Classes which access the database should be in (a) different package(s). It isn't possible to give any more details unless I spent much more time than I have to studying your app.
 
Kishor Joshi
Ranch Hand
Posts: 674
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@Campbell

I am making a multi-tier application of 1M users.

In which there is an call to database that will fetch all data from database.And Front end design I am using JSP and Servlets,CSS,JQuery,BootStrap,Ajax.

For Backend I am using Spring+Hibernate combination.
I have organized all web tier code under WebContent directory with different folder name JSP,CSS,HTML and so on.

I want how should I organize Java classes and I am also using Spring+Hibernate.So please answar how to effectively organize Spring Controller and Hibernate class taking as references


I hope you got my point
 
Campbell Ritchie
Marshal
Posts: 56600
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have, but I don't know any more. Sorry.
 
Kishor Joshi
Ranch Hand
Posts: 674
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks everyone for wonderful inputs
 
Sheriff
Posts: 4289
127
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For me, I often use this package layout:

domain.project.dao
domain.project.model
domain.project.mvc
domain.project.mvc.view
domain.project.mvc.controller


That's just a rough outline, but maybe it will help.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!