| 
									
										
										
										
											2016-04-06 13:14:10 +05:30
										 |  |  | --- | 
					
						
							|  |  |  | layout: pattern | 
					
						
							|  |  |  | title: Data Mapper | 
					
						
							|  |  |  | folder: data-mapper | 
					
						
							| 
									
										
										
										
											2016-04-24 12:58:38 +02:00
										 |  |  | permalink: /patterns/data-mapper/ | 
					
						
							| 
									
										
										
										
											2019-12-13 21:09:28 +02:00
										 |  |  | categories: Architectural | 
					
						
							| 
									
										
										
										
											2016-04-06 13:14:10 +05:30
										 |  |  | tags: | 
					
						
							| 
									
										
										
										
											2019-12-13 21:09:28 +02:00
										 |  |  |  - Decoupling | 
					
						
							| 
									
										
										
										
											2016-04-06 13:14:10 +05:30
										 |  |  | --- | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ## Intent
 | 
					
						
							|  |  |  | A layer of mappers that moves data between objects and a database while keeping them independent of each other and the mapper itself | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-07 20:01:13 +02:00
										 |  |  | ## Class diagram
 | 
					
						
							| 
									
										
										
										
											2016-04-06 13:14:10 +05:30
										 |  |  |  | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ## Applicability
 | 
					
						
							|  |  |  | Use the Data Mapper in any of the following situations | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-04-06 13:18:42 +05:30
										 |  |  | * when you want to decouple data objects from DB access layer  | 
					
						
							|  |  |  | * when you want to write multiple data retrieval/persistence implementations | 
					
						
							| 
									
										
										
										
											2016-04-06 13:14:10 +05:30
										 |  |  | 
 | 
					
						
							|  |  |  | ## Credits
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | * [Data Mapper](http://richard.jp.leguen.ca/tutoring/soen343-f2010/tutorials/implementing-data-mapper/) |