Browse Source

update readme

Froilan Miranda 6 years ago
parent
commit
db10b2b568
1 changed files with 16 additions and 6 deletions
  1. 16
    6
      README.md

+ 16
- 6
README.md View File

10
 		*  password VARCHAR(20)
10
 		*  password VARCHAR(20)
11
 		*  PRIMARY KEY = id
11
 		*  PRIMARY KEY = id
12
 
12
 
13
-# PART 2 - CREATE JAVA APP
13
+# PART 2 - Create Java App
14
 
14
 
15
 ## Adding dependencies
15
 ## Adding dependencies
16
 1 Create a new Java Maven project
16
 1 Create a new Java Maven project
17
-2 Update the pom.xml file by adding the following dependencies
17
+2 Update the pom.xml file by adding the following dependencies. These are the dependencies for the ORM library we will be using.
18
+
18
 ```
19
 ```
19
         <!-- https://mvnrepository.com/artifact/com.j256.ormlite/ormlite-core -->
20
         <!-- https://mvnrepository.com/artifact/com.j256.ormlite/ormlite-core -->
20
         <dependency>
21
         <dependency>
29
             <artifactId>ormlite-jdbc</artifactId>
30
             <artifactId>ormlite-jdbc</artifactId>
30
             <version>4.48</version>
31
             <version>4.48</version>
31
         </dependency>
32
         </dependency>
32
-        ```
33
-These are the dependencies for the ORM library we will be using
33
+```
34
+
34
 
35
 
35
-3 Then also add the following
36
+3 Then also add the following. This is a dependency that allows us to connect our Java code to MySql
36
 
37
 
37
 ```
38
 ```
38
         <!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
39
         <!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
114
     }
115
     }
115
 }
116
 }
116
 ```
117
 ```
118
+The things to notice here are the annotations. These annotations tell OrmLite how to relate our Java Objects to the records in MySQL
119
+
117
 ## Implement the ORM
120
 ## Implement the ORM
118
 
121
 
119
 Create a Java class name 'AccountApp'
122
 Create a Java class name 'AccountApp'
135
         ConnectionSource connectionSource = null;
138
         ConnectionSource connectionSource = null;
136
         try {
139
         try {
137
             // create our data-source for the database
140
             // create our data-source for the database
138
-            connectionSource = new JdbcConnectionSource(DATABASE_URL, "root", "");
141
+            connectionSource = new JdbcConnectionSource(DATABASE_URL, YOURUSERNAME, YOURPASSWORD);
139
             // setup our  DAOs
142
             // setup our  DAOs
140
             setupDao(connectionSource);
143
             setupDao(connectionSource);
141
             // read, write and delete some data
144
             // read, write and delete some data
180
     }
183
     }
181
 }
184
 }
182
 ```
185
 ```
186
+Some of the things to take notice of are the objects that libraries offer use:
187
+
188
+* JdbcConnectionSource from the JDBC library
189
+* Dao and DaoManager from the OrmLite
190
+
191
+! Links to the above APIs are listed below
183
 
192
 
184
 Now if we run this we should see some info in the console of IntelliJ telling us that the program ran ok. And if we look over to MySQL we can query the table and see that our code has create and updated a record in out database
193
 Now if we run this we should see some info in the console of IntelliJ telling us that the program ran ok. And if we look over to MySQL we can query the table and see that our code has create and updated a record in out database
185
 
194
 
194
 ### References
203
 ### References
195
 * [OrmLite core API](http://ormlite.com/javadoc/ormlite-core/)
204
 * [OrmLite core API](http://ormlite.com/javadoc/ormlite-core/)
196
 * [OrmLite JDBC](http://ormlite.com/javadoc/ormlite-jdbc/)
205
 * [OrmLite JDBC](http://ormlite.com/javadoc/ormlite-jdbc/)
206
+* [JdbcConnectionSource](http://ormlite.com/javadoc/ormlite-jdbc/com/j256/ormlite/jdbc/JdbcConnectionSource.html)
197
 * [What is CRUD](https://en.wikipedia.org/wiki/Create,_read,_update_and_delete)
207
 * [What is CRUD](https://en.wikipedia.org/wiki/Create,_read,_update_and_delete)