aspose file tools*
The moose likes Java in General and the fly likes Data Abstract Class & MVC Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Data Abstract Class & MVC" Watch "Data Abstract Class & MVC" New topic
Author

Data Abstract Class & MVC

Tim Jones
Greenhorn

Joined: Apr 06, 2008
Posts: 28
I have a method in my Data Abstraction Object (DOA) Class that retrieves data (row by row)from the database. I'd to pass this data (see line 14) to the Controller Class (MVC) where the data will be processed. The Controller Class cannot have direct access because this will be break MVC Convention. Somebody recommended to create an API. I dont know very much about API's and would like some pointers on how to approach this task, including any other alternative methods that maybe available. Thanks



Ben Ooms
Ranch Hand

Joined: May 16, 2011
Posts: 44

Assuming that the controler calls the DAO you could return the resultset to the controler. Let the controler iterate trough the rows and process the data
Tim Jones
Greenhorn

Joined: Apr 06, 2008
Posts: 28
Ben Ooms wrote:Assuming that the controler calls the DAO you could return the resultset to the controler. Let the controler iterate trough the rows and process the data



The problem is that the Controller cannot call the DAO because will be breaking MVC Rules even though it is technical possible.
Ben Ooms
Ranch Hand

Joined: May 16, 2011
Posts: 44

And if you use Events? Make the Controler a listener of DAO, when DAO has data to process fire a event with the data to process. The controler will as listener do its processing without calling the DAO.
Tim Jones
Greenhorn

Joined: Apr 06, 2008
Posts: 28
Ben Ooms wrote:And if you use Events? Make the Controler a listener of DAO, when DAO has data to process fire a event with the data to process. The controler will as listener do its processing without calling the DAO.


I'm not sure if this is allowed either, can some confirm?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Data Abstract Class & MVC