﻿WEBVTT

1
00:00:01.186 --> 00:00:03.278
<v Instructor>Hey, in this video we're gonna learn</v>

2
00:00:03.278 --> 00:00:06.695
how to create a JSF database application.

3
00:00:08.325 --> 00:00:09.970
So for our class project,

4
00:00:09.970 --> 00:00:13.624
we're actually gonna build a full working JSF application

5
00:00:13.624 --> 00:00:15.438
that connects to a database,

6
00:00:15.438 --> 00:00:17.614
so we'll build all the front-end JSF pages

7
00:00:17.614 --> 00:00:19.441
in the beans and we'll connect

8
00:00:19.441 --> 00:00:22.992
to a MySQL database in the background.

9
00:00:22.992 --> 00:00:25.259
Alright, so before we get into the coding,

10
00:00:25.259 --> 00:00:26.693
let's look at a quick demo

11
00:00:26.693 --> 00:00:28.815
on how this application will work.

12
00:00:28.815 --> 00:00:32.336
So I'll just drop in the URL to the final application.

13
00:00:32.336 --> 00:00:34.388
This is for a fictional university

14
00:00:34.388 --> 00:00:36.263
called FooBar University,

15
00:00:36.263 --> 00:00:39.230
and what we'll do is we'll keep track of students.

16
00:00:39.230 --> 00:00:41.545
So right here we have a list of students that we have,

17
00:00:41.545 --> 00:00:43.762
and that's from the MySQL database.

18
00:00:43.762 --> 00:00:45.859
We'll be able to add a student,

19
00:00:45.859 --> 00:00:48.902
and we'll also be able to perform some operations,

20
00:00:48.902 --> 00:00:52.586
such as updating a student and also deleting a student.

21
00:00:52.586 --> 00:00:53.627
So let's go ahead and start off

22
00:00:53.627 --> 00:00:56.044
by adding a new student here.

23
00:00:57.822 --> 00:01:01.989
So I'm gonna add this new student called Bill Appleby.

24
00:01:04.500 --> 00:01:07.000
And his email is bill@foo.com,

25
00:01:08.482 --> 00:01:09.685
and once I'm happy with all that

26
00:01:09.685 --> 00:01:11.569
information for Bill Appleby,

27
00:01:11.569 --> 00:01:14.736
I'll go ahead and hit the save button.

28
00:01:15.839 --> 00:01:17.526
So great, so now look at our list.

29
00:01:17.526 --> 00:01:19.555
Note here the first student is Bill Appleby

30
00:01:19.555 --> 00:01:21.656
because we're sorting by last name.

31
00:01:21.656 --> 00:01:23.176
So he shows up first.

32
00:01:23.176 --> 00:01:25.366
So he's entered, we have his first his last name,

33
00:01:25.366 --> 00:01:29.533
and also his email address, so this is really good.

34
00:01:30.994 --> 00:01:32.653
Now what I like to do is actually change

35
00:01:32.653 --> 00:01:35.466
his email address so instead of bill@foo.com,

36
00:01:35.466 --> 00:01:39.189
I'll hit on update and I'll go through and update this user.

37
00:01:39.189 --> 00:01:41.500
So I'll keep the first and last name the same,

38
00:01:41.500 --> 00:01:44.288
but I just wanna change his email address.

39
00:01:44.288 --> 00:01:47.094
So his email address is bill@luv2code.com,

40
00:01:47.094 --> 00:01:50.552
because hey, we're all about love around here.

41
00:01:50.552 --> 00:01:53.870
So I'll go ahead and hit save,

42
00:01:53.870 --> 00:01:56.062
and so now we should see the updated entry

43
00:01:56.062 --> 00:01:57.712
here for Bill Appleby.

44
00:01:57.712 --> 00:02:01.052
Note his email address is bill@luv2code.com.

45
00:02:01.052 --> 00:02:01.885
So very good.

46
00:02:01.885 --> 00:02:06.052
So our update operation worked out just fine for us.

47
00:02:09.207 --> 00:02:11.160
So now what I like to do is actually delete the user.

48
00:02:11.160 --> 00:02:12.615
So I click on delete, it'll prompt me

49
00:02:12.615 --> 00:02:15.820
Are you sure, I'll go ahead and hit OK,

50
00:02:15.820 --> 00:02:18.677
and then it'll actually delete the user from the database.

51
00:02:18.677 --> 00:02:21.302
We'll refresh our screen, and we'll note here

52
00:02:21.302 --> 00:02:24.929
that Bill Appleby is no longer listed in the list

53
00:02:24.929 --> 00:02:26.573
of students from the database,

54
00:02:26.573 --> 00:02:28.113
so that works out for us also.

55
00:02:28.113 --> 00:02:29.275
So this is really good.

56
00:02:29.275 --> 00:02:31.802
So we've covered all the major operations here

57
00:02:31.802 --> 00:02:34.819
that you would have in a database application.

58
00:02:34.819 --> 00:02:37.619
We had the scenario of listing students,

59
00:02:37.619 --> 00:02:41.455
adding students, updating, and also deleting,

60
00:02:41.455 --> 00:02:43.296
and we'll learn all the key steps

61
00:02:43.296 --> 00:02:46.795
on how to make that work in this video series.

62
00:02:46.795 --> 00:02:48.784
Alright, let's go take a look at MySQL

63
00:02:48.784 --> 00:02:50.533
as far as the database in the background.

64
00:02:50.533 --> 00:02:52.696
So we have a table out there called students,

65
00:02:52.696 --> 00:02:54.168
we can query that table

66
00:02:54.168 --> 00:02:56.141
and then we can get the actual results.

67
00:02:56.141 --> 00:02:58.900
So we see we have five students out here,

68
00:02:58.900 --> 00:03:02.665
first name, last name, and email address.

69
00:03:02.665 --> 00:03:03.863
So this all looks really good.

70
00:03:03.863 --> 00:03:05.507
So our application will actually interact

71
00:03:05.507 --> 00:03:09.674
with the database throughout the application lifecycle.

72
00:03:13.138 --> 00:03:15.091
Alright, so let's figure out how we're gonna do this.

73
00:03:15.091 --> 00:03:17.261
You know I like to do lists, I like roadmaps.

74
00:03:17.261 --> 00:03:18.854
So the first thing we're gonna do is figure out

75
00:03:18.854 --> 00:03:21.972
how to set up our database Dev environment,

76
00:03:21.972 --> 00:03:23.833
then we'll learn how to list students

77
00:03:23.833 --> 00:03:25.926
doing a query on the database.

78
00:03:25.926 --> 00:03:28.432
Next we'll go through and learn how to add a student,

79
00:03:28.432 --> 00:03:31.582
and that's by doing a SQL insert.

80
00:03:31.582 --> 00:03:32.884
And then from there we'll go ahead

81
00:03:32.884 --> 00:03:34.572
and perform updates on a student,

82
00:03:34.572 --> 00:03:37.540
and that's using a SQL update statement.

83
00:03:37.540 --> 00:03:38.931
And then finally, we'll wrap it up

84
00:03:38.931 --> 00:03:42.441
by doing a delete student, so using a SQL delete statement.

85
00:03:42.441 --> 00:03:44.296
And what I'll do in the following videos here

86
00:03:44.296 --> 00:03:46.145
is that I'll bring things down for you

87
00:03:46.145 --> 00:03:48.348
step-by-step just like I've done before.

88
00:03:48.348 --> 00:03:49.880
So we'll spend a special video

89
00:03:49.880 --> 00:03:52.472
on Database environment, another one on listing,

90
00:03:52.472 --> 00:03:54.445
adding, updating, and deleting.

91
00:03:54.445 --> 00:03:56.407
We'll do all that in separate videos

92
00:03:56.407 --> 00:03:58.640
and I'll walk through all the code for you

93
00:03:58.640 --> 00:04:00.851
and show you how to pull it all together.

94
00:04:00.851 --> 00:04:02.881
Alright, well I'm really excited about this.

95
00:04:02.881 --> 00:04:04.490
Let's go ahead and dive in

96
00:04:04.490 --> 00:04:05.823
and get started.

