-
Notifications
You must be signed in to change notification settings - Fork 0
/
DAO_Design_Pattern.mm
85 lines (75 loc) · 2.15 KB
/
DAO_Design_Pattern.mm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<map version="1.0.1">
<!-- To view this file, download free mind mapping software FreeMind from http://freemind.sourceforge.net -->
<node CREATED="1494694956769" ID="ID_1871493965" MODIFIED="1494695891041" TEXT="DAO">
<richcontent TYPE="NOTE"><html>
<head>
</head>
<body>
<h1>
Data Access Object - industry design pattern
</h1>
<p>
Thx to https://dzone.com/articles/database-interaction-dao-and
</p>
<p>
</p>
<p>
Helps perform CRUD operations on the database. Provides methods for insertion, deletion, update and finding of database entities / objects.
</p>
<p>
</p>
<p>
The DAO pattern <b>is supposed to have a DAO interface, class and factory corresponding to each table in the database</b>.
</p>
<p>
</p>
</body>
</html>
</richcontent>
<node CREATED="1494695617807" ID="ID_138003290" MODIFIED="1494695928492" POSITION="right" TEXT="Interface">
<richcontent TYPE="NOTE"><html>
<head>
</head>
<body>
<p>
Interface could look like this ...
</p>
<p>
</p>
<pre><code class="java">package com.company.app.dao;
public interface {
	public Employee[] findAll() throws SQLException;
	public Employee findByPK(EmployeePK) throws SQL Exception;
	public Employee[] findbyemployeename(String EmployeeName) throws SQLException;
	public boolean insert(Employee employee) throws SQLException;
	public boolean update(Employee employee) throws SQLException;
	public boolean delete(Employee employee) throws SQLException;
}</code>
</pre>
</body>
</html>
</richcontent>
</node>
<node CREATED="1494695626076" ID="ID_718708648" MODIFIED="1494696011051" POSITION="left" TEXT="Factory">
<richcontent TYPE="NOTE"><html>
<head>
</head>
<body>
<p>
Factory could be implemented like this ...
</p>
<p>
</p>
<pre><code class="java">package com.company.app.factory;
public class EmployeeDAOFactory {
	public static EmployeeDAO create() {
		return (new EmployeeDAOImpl());
	}
}</code>
</pre>
</body>
</html>
</richcontent>
</node>
</node>
</map>