What Changes in Spring1:53 with Chris Ramacciotti
This video gives a quick overview of the differences we'll see in integrating Hibernate with Spring, in comparison to using Hibernate outside of the Spring Framework.
Let's start by talking about how things look a little different when incorporating 0:00 hibernate into spring, 0:04 as opposed to using hibernate in a standard command line application. 0:06 First, recall that in hibernate basics we created a hibernate session factory 0:10 which encapsulates all the mapping data between our entities. 0:14 Remember, those are our model classes or pojo's and a database. 0:18 In this course, instead of the hibernate SessionFactory, 0:22 we'll use the spring framework's LocalSessionFactoryBean. 0:26 This is because a spring container, or application context 0:29 will be managing the SessionFactory, creating it as a Spring bean at runtime. 0:33 Next in Spring, we'll configure the data source separately using a third party 0:38 library from Apache called DBCP, which stands for Database Connection Pooling. 0:43 In a nutshell, connection pooling allows the application to keep alive a specified 0:49 number of database connections, and then reuse them when they're needed. 0:54 This gives us a boost in performance, 0:59 since database connections take some time to establish. 1:00 Also related to the data source, if you recall in Hibernate basics, 1:04 we let Hibernate grab the configuration settings for our data source. 1:09 In this course, we'll instead configure the data source as a Spring bean, 1:13 kind of like the LocalSessionFactoryBean. 1:17 And this is where we'll specify things like the connection URL, 1:20 the database driver that Hibernate should use, which is H2 in our case. 1:24 In addition to these three things, 1:29 you'll see plenty more that will add to this application. 1:31 We'll explore application design principles as they apply 1:34 to separating the components into web components like Spring controllers. 1:37 Data access components call data access objects, and 1:41 a component that sits between those two called services. 1:44 Next, we'll review the application that we're going to be working with 1:48 during this course. 1:51
You need to sign up for Treehouse in order to download course files.Sign up