Chaitali Patel hace 6 años
padre
commit
db86d3b7a3

+ 1
- 0
.idea/.name Ver fichero

@@ -0,0 +1 @@
1
+orm_project

+ 6
- 0
.idea/codeStyles/Project.xml Ver fichero

@@ -0,0 +1,6 @@
1
+<component name="ProjectCodeStyleConfiguration">
2
+  <code_scheme name="Project" version="173">
3
+    <option name="LINE_SEPARATOR" value="&#13;" />
4
+    <option name="WRAP_WHEN_TYPING_REACHES_RIGHT_MARGIN" value="true" />
5
+  </code_scheme>
6
+</component>

+ 5
- 0
.idea/codeStyles/codeStyleConfig.xml Ver fichero

@@ -0,0 +1,5 @@
1
+<component name="ProjectCodeStyleConfiguration">
2
+  <state>
3
+    <option name="USE_PER_PROJECT_SETTINGS" value="true" />
4
+  </state>
5
+</component>

+ 13
- 0
.idea/compiler.xml Ver fichero

@@ -0,0 +1,13 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project version="4">
3
+  <component name="CompilerConfiguration">
4
+    <annotationProcessing>
5
+      <profile name="Maven default annotation processors profile" enabled="true">
6
+        <sourceOutputDir name="target/generated-sources/annotations" />
7
+        <sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
8
+        <outputRelativeToContentRoot value="true" />
9
+        <module name="ZCW-ORM-SimpleAccount" />
10
+      </profile>
11
+    </annotationProcessing>
12
+  </component>
13
+</project>

+ 3
- 0
.idea/dictionaries/chaitalipatel.xml Ver fichero

@@ -0,0 +1,3 @@
1
+<component name="ProjectDictionaryState">
2
+  <dictionary name="chaitalipatel" />
3
+</component>

+ 14
- 0
.idea/misc.xml Ver fichero

@@ -0,0 +1,14 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project version="4">
3
+  <component name="ExternalStorageConfigurationManager" enabled="true" />
4
+  <component name="MavenProjectsManager">
5
+    <option name="originalFiles">
6
+      <list>
7
+        <option value="$PROJECT_DIR$/pom.xml" />
8
+      </list>
9
+    </option>
10
+  </component>
11
+  <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
12
+    <output url="file://$PROJECT_DIR$/out" />
13
+  </component>
14
+</project>

+ 6
- 0
.idea/vcs.xml Ver fichero

@@ -0,0 +1,6 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project version="4">
3
+  <component name="VcsDirectoryMappings">
4
+    <mapping directory="" vcs="Git" />
5
+  </component>
6
+</project>

+ 359
- 0
.idea/workspace.xml Ver fichero

@@ -0,0 +1,359 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project version="4">
3
+  <component name="ChangeListManager">
4
+    <list default="true" id="92d3adca-11be-4aaf-9c66-8b5b58b68b39" name="Default Changelist" comment="">
5
+      <change afterPath="$PROJECT_DIR$/.idea/.name" afterDir="false" />
6
+      <change afterPath="$PROJECT_DIR$/.idea/codeStyles/Project.xml" afterDir="false" />
7
+      <change afterPath="$PROJECT_DIR$/.idea/codeStyles/codeStyleConfig.xml" afterDir="false" />
8
+      <change afterPath="$PROJECT_DIR$/.idea/compiler.xml" afterDir="false" />
9
+      <change afterPath="$PROJECT_DIR$/.idea/dictionaries/chaitalipatel.xml" afterDir="false" />
10
+      <change afterPath="$PROJECT_DIR$/.idea/misc.xml" afterDir="false" />
11
+      <change afterPath="$PROJECT_DIR$/.idea/vcs.xml" afterDir="false" />
12
+      <change afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
13
+      <change afterPath="$PROJECT_DIR$/ZCW-ORM-SimpleAccount.iml" afterDir="false" />
14
+      <change afterPath="$PROJECT_DIR$/pom.xml" afterDir="false" />
15
+      <change afterPath="$PROJECT_DIR$/src/main/java/Account.java" afterDir="false" />
16
+      <change afterPath="$PROJECT_DIR$/src/main/java/AccountApp.java" afterDir="false" />
17
+      <change afterPath="$PROJECT_DIR$/target/classes/Account.class" afterDir="false" />
18
+      <change afterPath="$PROJECT_DIR$/target/classes/AccountApp.class" afterDir="false" />
19
+    </list>
20
+    <ignored path="$PROJECT_DIR$/out/" />
21
+    <ignored path="$PROJECT_DIR$/target/" />
22
+    <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
23
+    <option name="SHOW_DIALOG" value="false" />
24
+    <option name="HIGHLIGHT_CONFLICTS" value="true" />
25
+    <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
26
+    <option name="LAST_RESOLUTION" value="IGNORE" />
27
+  </component>
28
+  <component name="FUSProjectUsageTrigger">
29
+    <session id="-626389632">
30
+      <usages-collector id="statistics.lifecycle.project">
31
+        <counts>
32
+          <entry key="project.open.time.7" value="1" />
33
+          <entry key="project.opened" value="1" />
34
+        </counts>
35
+      </usages-collector>
36
+      <usages-collector id="statistics.file.extensions.open">
37
+        <counts>
38
+          <entry key="java" value="2" />
39
+          <entry key="xml" value="2" />
40
+        </counts>
41
+      </usages-collector>
42
+      <usages-collector id="statistics.file.types.open">
43
+        <counts>
44
+          <entry key="JAVA" value="2" />
45
+          <entry key="XML" value="2" />
46
+        </counts>
47
+      </usages-collector>
48
+      <usages-collector id="statistics.file.extensions.edit">
49
+        <counts>
50
+          <entry key="java" value="19" />
51
+          <entry key="xml" value="13" />
52
+        </counts>
53
+      </usages-collector>
54
+      <usages-collector id="statistics.file.types.edit">
55
+        <counts>
56
+          <entry key="JAVA" value="19" />
57
+          <entry key="XML" value="13" />
58
+        </counts>
59
+      </usages-collector>
60
+    </session>
61
+  </component>
62
+  <component name="FileEditorManager">
63
+    <leaf>
64
+      <file pinned="false" current-in-tab="false">
65
+        <entry file="file://$PROJECT_DIR$/pom.xml">
66
+          <provider selected="true" editor-type-id="text-editor">
67
+            <state relative-caret-position="328">
68
+              <caret line="27" column="37" selection-start-line="27" selection-start-column="37" selection-end-line="27" selection-end-column="37" />
69
+            </state>
70
+          </provider>
71
+        </entry>
72
+      </file>
73
+      <file pinned="false" current-in-tab="false">
74
+        <entry file="file://$PROJECT_DIR$/src/main/java/Account.java">
75
+          <provider selected="true" editor-type-id="text-editor">
76
+            <state relative-caret-position="36">
77
+              <caret line="33" column="5" selection-start-line="33" selection-start-column="5" selection-end-line="33" selection-end-column="5" />
78
+              <folding>
79
+                <element signature="imports" expanded="true" />
80
+                <element signature="e#668#669#0" expanded="true" />
81
+                <element signature="e#700#701#0" expanded="true" />
82
+                <element signature="e#844#845#0" expanded="true" />
83
+                <element signature="e#869#870#0" expanded="true" />
84
+                <element signature="e#900#901#0" expanded="true" />
85
+                <element signature="e#927#928#0" expanded="true" />
86
+                <element signature="e#967#968#0" expanded="true" />
87
+                <element signature="e#999#1000#0" expanded="true" />
88
+                <element signature="e#1034#1035#0" expanded="true" />
89
+                <element signature="e#1065#1066#0" expanded="true" />
90
+                <element signature="e#1113#1114#0" expanded="true" />
91
+                <element signature="e#1153#1154#0" expanded="true" />
92
+                <element signature="e#1196#1197#0" expanded="true" />
93
+                <element signature="e#1234#1235#0" expanded="true" />
94
+              </folding>
95
+            </state>
96
+          </provider>
97
+        </entry>
98
+      </file>
99
+      <file pinned="false" current-in-tab="true">
100
+        <entry file="file://$PROJECT_DIR$/src/main/java/AccountApp.java">
101
+          <provider selected="true" editor-type-id="text-editor">
102
+            <state relative-caret-position="945">
103
+              <caret line="63" column="5" lean-forward="true" selection-start-line="63" selection-start-column="5" selection-end-line="63" selection-end-column="5" />
104
+              <folding>
105
+                <element signature="imports" expanded="true" />
106
+              </folding>
107
+            </state>
108
+          </provider>
109
+        </entry>
110
+      </file>
111
+    </leaf>
112
+  </component>
113
+  <component name="FileTemplateManagerImpl">
114
+    <option name="RECENT_TEMPLATES">
115
+      <list>
116
+        <option value="Class" />
117
+      </list>
118
+    </option>
119
+  </component>
120
+  <component name="Git.Settings">
121
+    <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
122
+  </component>
123
+  <component name="IdeDocumentHistory">
124
+    <option name="CHANGED_PATHS">
125
+      <list>
126
+        <option value="$PROJECT_DIR$/pom.xml" />
127
+        <option value="$PROJECT_DIR$/src/main/java/Account.java" />
128
+        <option value="$PROJECT_DIR$/src/main/java/AccountApp.java" />
129
+      </list>
130
+    </option>
131
+  </component>
132
+  <component name="JsBuildToolGruntFileManager" detection-done="true" sorting="DEFINITION_ORDER" />
133
+  <component name="JsBuildToolPackageJson" detection-done="true" sorting="DEFINITION_ORDER" />
134
+  <component name="JsGulpfileManager">
135
+    <detection-done>true</detection-done>
136
+    <sorting>DEFINITION_ORDER</sorting>
137
+  </component>
138
+  <component name="ProjectFrameBounds" extendedState="1">
139
+    <option name="x" value="3" />
140
+    <option name="y" value="23" />
141
+    <option name="width" value="995" />
142
+    <option name="height" value="715" />
143
+  </component>
144
+  <component name="ProjectInspectionProfilesVisibleTreeState">
145
+    <entry key="Project Default">
146
+      <profile-state>
147
+        <expanded-state>
148
+          <State />
149
+          <State>
150
+            <id>Android</id>
151
+          </State>
152
+          <State>
153
+            <id>CSS</id>
154
+          </State>
155
+          <State>
156
+            <id>CorrectnessLintAndroid</id>
157
+          </State>
158
+          <State>
159
+            <id>Java</id>
160
+          </State>
161
+          <State>
162
+            <id>LintAndroid</id>
163
+          </State>
164
+          <State>
165
+            <id>Probable bugsCSS</id>
166
+          </State>
167
+          <State>
168
+            <id>Probable bugsJava</id>
169
+          </State>
170
+          <State>
171
+            <id>RELAX NG</id>
172
+          </State>
173
+          <State>
174
+            <id>XPath</id>
175
+          </State>
176
+          <State>
177
+            <id>XSLT</id>
178
+          </State>
179
+        </expanded-state>
180
+        <selected-state>
181
+          <State>
182
+            <id>Android</id>
183
+          </State>
184
+        </selected-state>
185
+      </profile-state>
186
+    </entry>
187
+  </component>
188
+  <component name="ProjectView">
189
+    <navigator proportions="" version="1">
190
+      <foldersAlwaysOnTop value="true" />
191
+    </navigator>
192
+    <panes>
193
+      <pane id="ProjectPane">
194
+        <subPane>
195
+          <expand>
196
+            <path>
197
+              <item name="orm_project" type="b2602c69:ProjectViewProjectNode" />
198
+              <item name="ZCW-ORM-SimpleAccount" type="462c0819:PsiDirectoryNode" />
199
+            </path>
200
+            <path>
201
+              <item name="orm_project" type="b2602c69:ProjectViewProjectNode" />
202
+              <item name="ZCW-ORM-SimpleAccount" type="462c0819:PsiDirectoryNode" />
203
+              <item name="src" type="462c0819:PsiDirectoryNode" />
204
+            </path>
205
+            <path>
206
+              <item name="orm_project" type="b2602c69:ProjectViewProjectNode" />
207
+              <item name="ZCW-ORM-SimpleAccount" type="462c0819:PsiDirectoryNode" />
208
+              <item name="src" type="462c0819:PsiDirectoryNode" />
209
+              <item name="main" type="462c0819:PsiDirectoryNode" />
210
+            </path>
211
+            <path>
212
+              <item name="orm_project" type="b2602c69:ProjectViewProjectNode" />
213
+              <item name="ZCW-ORM-SimpleAccount" type="462c0819:PsiDirectoryNode" />
214
+              <item name="src" type="462c0819:PsiDirectoryNode" />
215
+              <item name="main" type="462c0819:PsiDirectoryNode" />
216
+              <item name="java" type="462c0819:PsiDirectoryNode" />
217
+            </path>
218
+          </expand>
219
+          <select />
220
+        </subPane>
221
+      </pane>
222
+      <pane id="PackagesPane" />
223
+      <pane id="Scope" />
224
+    </panes>
225
+  </component>
226
+  <component name="PropertiesComponent">
227
+    <property name="WebServerToolWindowFactoryState" value="false" />
228
+    <property name="aspect.path.notification.shown" value="true" />
229
+    <property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1542557027022" />
230
+    <property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" />
231
+    <property name="nodejs_npm_path_reset_for_default_project" value="true" />
232
+    <property name="settings.editor.selected.configurable" value="preferences.sourceCode" />
233
+  </component>
234
+  <component name="RunDashboard">
235
+    <option name="ruleStates">
236
+      <list>
237
+        <RuleState>
238
+          <option name="name" value="ConfigurationTypeDashboardGroupingRule" />
239
+        </RuleState>
240
+        <RuleState>
241
+          <option name="name" value="StatusDashboardGroupingRule" />
242
+        </RuleState>
243
+      </list>
244
+    </option>
245
+  </component>
246
+  <component name="RunManager">
247
+    <configuration name="AccountApp" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
248
+      <option name="MAIN_CLASS_NAME" value="AccountApp" />
249
+      <module name="ZCW-ORM-SimpleAccount" />
250
+      <method v="2">
251
+        <option name="Make" enabled="true" />
252
+      </method>
253
+    </configuration>
254
+    <recent_temporary>
255
+      <list>
256
+        <item itemvalue="Application.AccountApp" />
257
+      </list>
258
+    </recent_temporary>
259
+  </component>
260
+  <component name="SvnConfiguration">
261
+    <configuration />
262
+  </component>
263
+  <component name="TaskManager">
264
+    <task active="true" id="Default" summary="Default task">
265
+      <changelist id="92d3adca-11be-4aaf-9c66-8b5b58b68b39" name="Default Changelist" comment="" />
266
+      <created>1542407861935</created>
267
+      <option name="number" value="Default" />
268
+      <option name="presentableId" value="Default" />
269
+      <updated>1542407861935</updated>
270
+      <workItem from="1542407867696" duration="4699000" />
271
+    </task>
272
+    <servers />
273
+  </component>
274
+  <component name="TimeTrackingManager">
275
+    <option name="totallyTimeSpent" value="4699000" />
276
+  </component>
277
+  <component name="ToolWindowManager">
278
+    <frame x="3" y="23" width="995" height="715" extended-state="1" />
279
+    <layout>
280
+      <window_info id="Image Layers" />
281
+      <window_info id="Designer" />
282
+      <window_info id="UI Designer" />
283
+      <window_info id="Capture Tool" />
284
+      <window_info id="Favorites" side_tool="true" />
285
+      <window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.16579224" />
286
+      <window_info id="Structure" order="1" side_tool="true" weight="0.25" />
287
+      <window_info anchor="bottom" id="Messages" weight="0.32905295" />
288
+      <window_info anchor="bottom" id="Database Changes" show_stripe_button="false" />
289
+      <window_info anchor="bottom" id="Version Control" />
290
+      <window_info active="true" anchor="bottom" id="Terminal" visible="true" weight="0.32905295" />
291
+      <window_info anchor="bottom" id="Event Log" side_tool="true" />
292
+      <window_info anchor="bottom" id="Message" order="0" />
293
+      <window_info anchor="bottom" id="Find" order="1" />
294
+      <window_info anchor="bottom" id="Run" order="2" weight="0.32905295" />
295
+      <window_info anchor="bottom" id="Debug" order="3" weight="0.4" />
296
+      <window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
297
+      <window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
298
+      <window_info anchor="bottom" id="TODO" order="6" />
299
+      <window_info anchor="right" id="Palette" />
300
+      <window_info anchor="right" id="Theme Preview" />
301
+      <window_info anchor="right" id="Capture Analysis" />
302
+      <window_info anchor="right" id="Palette&#9;" />
303
+      <window_info anchor="right" id="Database" />
304
+      <window_info anchor="right" id="Maven Projects" />
305
+      <window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" />
306
+      <window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
307
+      <window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
308
+    </layout>
309
+  </component>
310
+  <component name="TypeScriptGeneratedFilesManager">
311
+    <option name="version" value="1" />
312
+  </component>
313
+  <component name="VcsContentAnnotationSettings">
314
+    <option name="myLimit" value="2678400000" />
315
+  </component>
316
+  <component name="editorHistoryManager">
317
+    <entry file="file://$PROJECT_DIR$/pom.xml">
318
+      <provider selected="true" editor-type-id="text-editor">
319
+        <state relative-caret-position="328">
320
+          <caret line="27" column="37" selection-start-line="27" selection-start-column="37" selection-end-line="27" selection-end-column="37" />
321
+        </state>
322
+      </provider>
323
+    </entry>
324
+    <entry file="file://$PROJECT_DIR$/src/main/java/Account.java">
325
+      <provider selected="true" editor-type-id="text-editor">
326
+        <state relative-caret-position="36">
327
+          <caret line="33" column="5" selection-start-line="33" selection-start-column="5" selection-end-line="33" selection-end-column="5" />
328
+          <folding>
329
+            <element signature="imports" expanded="true" />
330
+            <element signature="e#668#669#0" expanded="true" />
331
+            <element signature="e#700#701#0" expanded="true" />
332
+            <element signature="e#844#845#0" expanded="true" />
333
+            <element signature="e#869#870#0" expanded="true" />
334
+            <element signature="e#900#901#0" expanded="true" />
335
+            <element signature="e#927#928#0" expanded="true" />
336
+            <element signature="e#967#968#0" expanded="true" />
337
+            <element signature="e#999#1000#0" expanded="true" />
338
+            <element signature="e#1034#1035#0" expanded="true" />
339
+            <element signature="e#1065#1066#0" expanded="true" />
340
+            <element signature="e#1113#1114#0" expanded="true" />
341
+            <element signature="e#1153#1154#0" expanded="true" />
342
+            <element signature="e#1196#1197#0" expanded="true" />
343
+            <element signature="e#1234#1235#0" expanded="true" />
344
+          </folding>
345
+        </state>
346
+      </provider>
347
+    </entry>
348
+    <entry file="file://$PROJECT_DIR$/src/main/java/AccountApp.java">
349
+      <provider selected="true" editor-type-id="text-editor">
350
+        <state relative-caret-position="945">
351
+          <caret line="63" column="5" lean-forward="true" selection-start-line="63" selection-start-column="5" selection-end-line="63" selection-end-column="5" />
352
+          <folding>
353
+            <element signature="imports" expanded="true" />
354
+          </folding>
355
+        </state>
356
+      </provider>
357
+    </entry>
358
+  </component>
359
+</project>

+ 2
- 0
ZCW-ORM-SimpleAccount.iml Ver fichero

@@ -0,0 +1,2 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<module type="JAVA_MODULE" version="4" />

+ 32
- 0
pom.xml Ver fichero

@@ -0,0 +1,32 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project xmlns="http://maven.apache.org/POM/4.0.0"
3
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5
+    <modelVersion>4.0.0</modelVersion>
6
+
7
+    <groupId>com.zipcode.chai</groupId>
8
+    <artifactId>orm_project</artifactId>
9
+    <version>1.0-SNAPSHOT</version>
10
+    <dependencies>
11
+        <!-- https://mvnrepository.com/artifact/com.j256.ormlite/ormlite-core -->
12
+        <dependency>
13
+            <groupId>com.j256.ormlite</groupId>
14
+            <artifactId>ormlite-core</artifactId>
15
+            <version>4.48</version>
16
+        </dependency>
17
+
18
+        <!-- https://mvnrepository.com/artifact/com.j256.ormlite/ormlite-jdbc -->
19
+        <dependency>
20
+            <groupId>com.j256.ormlite</groupId>
21
+            <artifactId>ormlite-jdbc</artifactId>
22
+            <version>4.48</version>
23
+        </dependency>
24
+        <!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
25
+        <dependency>
26
+            <groupId>mysql</groupId>
27
+            <artifactId>mysql-connector-java</artifactId>
28
+            <version>8.0.13</version>
29
+        </dependency>
30
+    </dependencies>
31
+
32
+</project>

+ 1
- 0
src/main/java/Account.java Ver fichero

@@ -0,0 +1 @@
1
+import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.table.DatabaseTable;

@DatabaseTable(tableName = "account")
public class Account {

    public static final String NAME_FIELD_NAME = "name";
    public static final String PASSWORD_FIELD_NAME = "password";

    @DatabaseField(columnName = "id", generatedId = true)
    private int id;

    @DatabaseField(columnName = "name", canBeNull = false)
    private String name;

    @DatabaseField(columnName = "password")
    private String password;

    Account() {
        // all persisted classes must define a no-arg constructor with at least package visibility
    }

    public Account(String name) {
        this.name = name;
    }

    public Account(String name, String password) {
        this.name = name;
        this.password = password;
    }

    public int getId() {
        return id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    @Override
    public int hashCode() {
        return name.hashCode();
    }

    @Override
    public boolean equals(Object other) {
        if (other == null || other.getClass() != getClass()) {
            return false;
        }
        return name.equals(((Account) other).name);
    }
}

+ 1
- 0
src/main/java/AccountApp.java Ver fichero

@@ -0,0 +1 @@
1
+import com.j256.ormlite.dao.Dao;
import com.j256.ormlite.dao.DaoManager;
import com.j256.ormlite.jdbc.JdbcConnectionSource;
import com.j256.ormlite.support.ConnectionSource;

public class AccountApp {

    // we are using a MySQl database
    private final static String DATABASE_URL = "jdbc:mysql://localhost:3306/orm_lab?useUnicode=true";

    private Dao<Account, Integer> accountDao;

    public static void main(String[] args) throws Exception {
        // turn our static method into an instance of Main
        new AccountApp().doMain(args);
    }

    private void doMain(String[] args) throws Exception {
        ConnectionSource connectionSource = null;
        try {
            // create our data-source for the database
            connectionSource = new JdbcConnectionSource(DATABASE_URL, "root", "Apple143!");
            // setup our  DAOs
            setupDao(connectionSource);
            // read, write and delete some data
            processData();

            System.out.println("\n\nIt seems to have worked\n\n");
        } finally {
            // destroy the data source which should close underlying connections
            if (connectionSource != null) {
                connectionSource.close();
            }
        }
    }

    /**
     * Read and write some example data.
     */
    private void processData() throws Exception {
        // create an instance of Account
        String name = "Jim Coakley";
        Account account = new Account(name);

        // persist the account object to the database
        accountDao.create(account);
        int id = account.getId();
        System.out.println(id);
        // assign a password
        account.setPassword("_secret");
        // update the database after changing the object
        accountDao.update(account);
        // delete the account
        //accountDao.deleteById(id);
    }

    /**
     * Setup our  DAOs
     */
    private void setupDao(ConnectionSource connectionSource) throws Exception {

        accountDao = DaoManager.createDao(connectionSource, Account.class);

    }
}

BIN
target/classes/Account.class Ver fichero


BIN
target/classes/AccountApp.class Ver fichero