• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Difference between a Command object and a Model object?

 
nilu chan
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am new to spring and tyring to understand the difference between Command object and a Model object in spring mvc.

A Bean that stores user input (usually entered through html forms) is called the Command object.
An object that gets returned to the user which can be used further for displaying data is called Model object.

Please correct me if I am wrong. Any pointers or links are also welcomed.
 
Vijitha Kumara
Bartender
Posts: 3913
9
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Model may not be returned to the user rather it's used to construct the response including preparation of the view to the user.
 
john christopher
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The ADO Command object is used to execute a single query against a database. The query can perform actions like creating, adding, retrieving, deleting or updating records.

If the query is used to retrieve data, the data will be returned as a RecordSet object. This means that the retrieved data can be manipulated by properties, collections, methods, and events of the Recordset object.

The major feature of the Command object is the ability to use stored queries and procedures with parameters.
ProgID
set objCommand=Server.CreateObject("ADODB.command")

Command object is used to submit and execute a specific (single) query against a database. The query can command a variety of actions, such as adding, creating, deleting, retrieving, or updating databases (record sets).

The term Model Object is an informal term, with no widely accepted definition. Here, Model Objects (MOs) refer to data-centric classes which encapsulate closely related items.

Model Objects :

are very common, and are used in almost all applications
are often central to an application, since they usually model problem domain objects
often map roughly to the records of a corresponding database table
are often used as return values for Data Access Object methods
are easily tested using JUnit (or a similar tool)
can be used to implement the Model in a Model-View-Controller pattern

 
Vijitha Kumara
Bartender
Posts: 3913
9
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to CodeRanch, John Christopher!
By ADO I guess you are talking about this which are used with ASP?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic