From the course: Spring Boot 2.0 Essential Training
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Building a Spring Data repository
From the course: Spring Boot 2.0 Essential Training
Building a Spring Data repository
- [Instructor] So we have a database wired into our application, at least an embedded one, so now it's time to build our first repository. Once again, we're going to go back into our room web application. Let's open up the Properties file once again, in Source, Main, Resources. We need to specify a very specific property, spring.jpa.hibernate.ddl-auto, and we want to set this equal to none. Because we have an embedded database that's already been populated with a schema and data, we don't want hibernate to create that for us. Next thing we need to do is we need to go modify one of our elements, so open up the models and the Room element, and we're going to go ahead and use this as our entity. Now, usually you're going to want some abstraction here, but for right now, this is fine. So @Entity to indicate that it's a javax.persistent entity, @Table, and we're going to put a name element here, and this is called Room,…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
(Locked)
The Repository pattern2m 58s
-
(Locked)
Introduction to Spring Data3m 46s
-
(Locked)
Building embedded databases4m 30s
-
(Locked)
Building a Spring Data repository4m 23s
-
(Locked)
Connecting to external databases4m 12s
-
(Locked)
Challenge: Build a data repository57s
-
(Locked)
Solution: Build a data repository2m 17s
-
(Locked)
-