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

Building a Spring Data repository

From the course: Spring Boot 2.0 Essential Training

Start my 1-month free trial

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,…

Contents