Spring Boot Quick Start 28 - Creating a Spring Data JPA Repository

Поділитися
Вставка
  • Опубліковано 22 гру 2016
  • Access the full course here: javabrains.io/courses/spring_...
    Learn how to create a Repository interface using Spring Data JPA.

КОМЕНТАРІ • 92

  • @_indrid_cold_
    @_indrid_cold_ 4 роки тому +44

    Definitely the best and clearest explanation I have found - and I've looked everywhere!

  • @reubenrajeev4861
    @reubenrajeev4861 4 роки тому +13

    I can't express how perfect this explanation is, not too much, not too little, exactly the right info for the task. Thank you!

  • @distilledwisdom1606
    @distilledwisdom1606 3 роки тому +3

    apart from learning java, I am also learning from you how to teach others, kids or team members..thanks a ton for all your efforts !! May God bless you !!

  • @preethibalaji1763
    @preethibalaji1763 3 роки тому

    Thanks a lot for the best and clear explanation ever. The idea of making the videos short keeps it going. Thanks again.

  • @porradelaslilas
    @porradelaslilas 5 років тому +34

    This tutorials are insane. You are very well explainer! Thank you very much!!!

  • @ZoHaiiB
    @ZoHaiiB 6 років тому +3

    Extremely well explained, thank you!

  • @SauravRajSrivastava
    @SauravRajSrivastava 7 років тому

    very well explained. Good effort.Appreciated.Thanks !!

  • @shahrukh49
    @shahrukh49 6 років тому

    Thanks for all your videos it is really helpful ..and Explaind very clearly love you bro.

  • @Skullid13
    @Skullid13 7 років тому +2

    Thank you Rajesh, great video

  • @baharulislammazumder3109
    @baharulislammazumder3109 6 років тому

    Nice step by step for start-up learning

  • @malikonlic5859
    @malikonlic5859 2 роки тому

    Brilliant explanation, very intuitive, thank you !!

  • @brukemekuria2401
    @brukemekuria2401 4 роки тому +5

    For those testing it out. Please make sure the topic you copy has the same root package name OR you can Refactor (Rename) the root package to be the same as the previous package, which is io.javabrains.

  • @ZouinkhiMarwan
    @ZouinkhiMarwan 5 років тому +1

    Very well explained, very clear english accent, Thanks

  • @yashnasery8501
    @yashnasery8501 9 місяців тому +2

    After Spring Boot 3.0 (Spring 6.0), annotations like @Entity and @Id are now part of jakarta.persistence package instead of the javax.persistence package.

  • @shashankshekhar7061
    @shashankshekhar7061 3 роки тому

    Thanks for such a lucid explanation

  • @pulkitkaushik4539
    @pulkitkaushik4539 3 роки тому +1

    can someone please help on the Bean error? It says it cannot find the bean for the interface..

  • @peerkhana8859
    @peerkhana8859 3 роки тому

    By far the best Explanation!!

  • @onsyedes213
    @onsyedes213 3 роки тому

    Just all i needed 🥰🥰 thank you a lot

  • @AhamedKabeer-wn1jb
    @AhamedKabeer-wn1jb 3 роки тому

    Beautifull explantion Sir..Thank you..

  • @sofieeilstein4
    @sofieeilstein4 3 роки тому

    Why do I go to college if I can just watch all of your content...... Thank you so much! Great work

  • @subiaali8745
    @subiaali8745 2 роки тому

    very good and brief content!! KUDOS

  • @c094728
    @c094728 6 років тому +1

    The Spring Starter Project shown in this video would not run when I used the default spring boot version 2.0.0.RELEASE. I had to change it to 1.5.9. It got an error
    Archive for required library: '.../.m2/repository/org/apache/derby/derby/10.14.1.0/derby-10.14.1.0.jar' in project 'course-api-data' cannot be read or is not a valid ZIP file

  • @blasnunez5493
    @blasnunez5493 3 роки тому

    Loveeeeed, thanks!!!

  • @AzeriFire
    @AzeriFire 5 років тому +11

    For all who have problem with @Entity, just be sure you are editing new project, not the old one's Topic class :) It happened to me. I got the fix it only after day :)

    • @szabolcstompos6750
      @szabolcstompos6750 4 роки тому +2

      It solved for me: change from "import org.springframework.data.annotation.Id;" to "import javax.persistence.Id;"

    • @dunareanu4795
      @dunareanu4795 3 роки тому +1

      yeah, that makes sense, got confused why I cant import @Entity... obviously because i was editing the old project, and it didnt have the JPA dependency like the new one

    • @harsharao7530
      @harsharao7530 2 роки тому

      Did the same mistake

  • @nis02002
    @nis02002 3 роки тому

    best tutorial, just end without notice.

  • @prayanisingh5793
    @prayanisingh5793 5 років тому +3

    For those getting org.hibernate.tool.schema.spi.CommandAcceptanceException: Error executing DDL "drop table topic" via JDBC Statement error,
    Just add-
    spring.jpa.hibernate.ddl-auto=update
    in the application.properties file
    It will be fixed.

  • @kalaivanisundaram3842
    @kalaivanisundaram3842 3 роки тому +2

    Hi, I Need your advice here.
    I’m building a web application which allows users to choose database (HK,UK,US) from the UI. Based on his selection of databases, I need to connect to respective DB instance in the spring boot + Jpa. Please share your thoughts!

  • @deepaksogani3920
    @deepaksogani3920 5 років тому

    If we want to connect with mysql then where we should give session factory details. We dont have spring.xml like in spring core then where we will give those details data source and hibernate specific properties.

  • @naved460
    @naved460 5 років тому

    Hi, If i have multiple entities in my project then how i will manage my repository. because i have to create multiple repository. is there any generic solution regarding the same.

  • @gs-rc3eq
    @gs-rc3eq 5 років тому +2

    Hi, can you do a project example with pagination / paging ?

  • @vijayanandmehta6379
    @vijayanandmehta6379 7 років тому

    may be a silly question but....the annotation you are using are provide by whom...Spring MVC?
    Please do reply
    thank you

  • @askiner43
    @askiner43 4 роки тому

    Hi there, the problem is using the postgresql db.it s really easy to follow your instructions on the derby database but as i changed the db to postgre the project turn out the problematic case

  • @elyu_vibes
    @elyu_vibes 3 роки тому

    Hi! I need clarification on design and architecture. I currently have this StudentController StudentServiceImpl (implements StudentService) StudentRepository. The way I understand is StudentRepository is part of Data Access Layer but not the same with DAO. If we follow the correct pattern/architecture, do I need to make a DAO and its implementation that will handle sa persistence or the StudentRepository is enough?

  • @SiddharthPant
    @SiddharthPant 6 років тому +3

    Since a class cannot extend an interface you might face problem if you forget to change the declaration of TopicRepository from class to interface. Only when you change it will Eclipse show you CrudRepository in the import hints.

  • @aaronotema3277
    @aaronotema3277 3 роки тому

    this guy is great

  • @ajaydangi582
    @ajaydangi582 5 років тому

    is it possible multiple search with like in spring data jpa? if yes ..then how
    pls help

  • @omkarkulkarni9202
    @omkarkulkarni9202 7 років тому

    did you forget to add @Repository annotation to the repository? If its not there, the repository wont be picked up by the compiler at runtime.

  • @thatactionhero3635
    @thatactionhero3635 6 років тому +1

    for alle that have problems with the @Entity annotation and the corrosponding javax.persistence.Entity, right click on your project and select clean and build. Your Dependency should thenfixed..

  • @bvbchris930
    @bvbchris930 5 років тому

    Unfortunality it does not work when I'm using the Spring Boot 2.0.6 RELEASE Version. I get this Error: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource
    I try out to add:
    javax.xml.bind
    jaxb-api
    2.3.0
    or:
    org.glassfish.jaxb
    jaxb-runtime
    but it doesen fix the problem. Does anyone know or have an idea how to fix the problem for Spring Boot 2.x ?

  • @Varun-ij2pp
    @Varun-ij2pp 2 роки тому

    What to give as datatype of Primary key if the primary key is Composite?

  • @theincrediblevee2764
    @theincrediblevee2764 8 місяців тому

    The TopicRepository is an interface and in the service me make an instance of an interface. In java I learned that one can not make an instance of an interface as it doesn't provide method definition. Then how is this possible in this case?

  • @MegaBelltone
    @MegaBelltone 7 років тому

    What if I am having composite ID in an Entity, and also many different type of entities to be persisted. Do I need to create that many number of interfaces ?

  • @ngn6454
    @ngn6454 3 роки тому

    Hi there, which repository should we implement for Bigquery?

  • @wBacz
    @wBacz 6 років тому

    I get errors: org.hibernate.tool.schema.spi.CommandAcceptanceException: Error executing DDL via JDBC Statement
    Caused by: java.sql.SQLSyntaxErrorException: Schema 'SA' does not exist . What's wrong?

  • @amitrathod1232
    @amitrathod1232 5 років тому +1

    HI am getting 404 error on GET/POST request
    Plz help me out ?

  • @leedy8135
    @leedy8135 Рік тому

    spring boot jparepository just only can connection one table?

  • @DTZFG
    @DTZFG 6 років тому +3

    Is the saved data persistent? If I kill the server and start it again, will the data be still in my "database"?

    • @amsfuy
      @amsfuy 6 років тому

      At least on my machine the database is empty on every new run of the application.

    • @aleksandarorelj367
      @aleksandarorelj367 6 років тому

      # Hibernate ddl-auto:
      # validate: validate the schema, makes no changes to the database.
      # update: update the schema.
      # create: creates the schema, destroying previous data.
      # create-drop: drop the schema at the end of the session.
      spring.jpa.hibernate.ddl-auto = update

  • @muhammadarslanbhatti2139
    @muhammadarslanbhatti2139 4 роки тому

    Java Brains + Telusko, and you are good to go.

  • @blemadd
    @blemadd 7 років тому

    Hey,
    The tutorial is awesome!
    i have one question. i'm not able to import org.springFramework.data.repository.CrudRepository. i tried maven force updating the project after emptying .m2 folder. but still the same.
    is zer any other way to do this?
    thanks in advance!

    • @SiddharthPant
      @SiddharthPant 6 років тому

      I faced this problem myself. You have to make the TopicRepository class as an interface and not a class. Then eclipse will allow you to import CrudRepository

  • @pankajshet1070
    @pankajshet1070 4 роки тому +1

    The Tutorials are good. But I dont think its voice of Koushik. Initially after intro in all lectures, I feel the voice is changed if I am not wrong. :)

  • @_qq-in9wk
    @_qq-in9wk 6 років тому +1

    好东西!

  • @venuchary3033
    @venuchary3033 7 років тому

    Hey Koushik
    Your tutorials are awesome. I have this one doubt. You said CrudRepository is a class and declared TopicRepository as an interface. In Java an interface cann't extend a class right?

    • @luv2bwith
      @luv2bwith 7 років тому +4

      CrudRepository is not a class,its an interface. There are a number of such interfaces provided by Spring Data JPA module viz. JPARepository, PagingAndSortingRepository, CrudRepository. The choice of repository depends upon the type of database you need to connect to.As for example,if you are connecting to MongoDB, you would use CrudRepository since PagingAndSortingRepository is difficult to implement in a MongoDB.
      The actual implementation for these repositories is abstracted by Spring Data JPA. You can create your own interface that extends any of these above Repository Interfaces and then implement that interface in any class of your own to provide additional or custom functionalities.

    • @humeyracal7755
      @humeyracal7755 7 років тому +1

      crudRepository is an Interface, and in Java an Interface can extend another Interface, not "implements"

  • @thepetiteotaku
    @thepetiteotaku Рік тому +1

    I'm getting this error. Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.
    Action:
    Consider the following:
    If you want an embedded database (H2, HSQL or Derby), please put it on the classpath.
    Even though I have added derby and JPA in my dependencies, it seems like Derby has not been added to the classpath. My understanding was that this should happen automatically, so not sure how to proceed. If anyone has encountered something similar and has any ideas please reply.

    • @thepetiteotaku
      @thepetiteotaku Рік тому

      I was using a newer parent version (3.0.1) I think. When I changed to 2.1.2.RELEASE it worked :)

    • @murtazaali621
      @murtazaali621 Рік тому

      please add this
      "@EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class})"
      in main class

  • @priyamgupta6446
    @priyamgupta6446 7 років тому +10

    You did not make any video on connection of actual database with Spring Boot

  • @kulikoffAS
    @kulikoffAS 6 років тому

    now it wont work if u didnt annotate ur interface which extends CrudRepo with @Repository

  • @machhindraneupane9207
    @machhindraneupane9207 7 років тому +1

    Field topicRepository in io.javabrains.springbootquickstart.topic.TopicService required a bean of type 'io.javabrains.springbootquickstart.topic.TopicRepository' that could not be found. problem

  • @rohitkarambali779
    @rohitkarambali779 3 роки тому

    voice is different, teaching is same as always great

  • @phongtrinhtien9237
    @phongtrinhtien9237 5 років тому

    How to delete multi item

  • @hughobrien4436
    @hughobrien4436 7 років тому

    You can not import the necessary libraries for CrudRepository after Spring Boot version 1.5.4.

    • @hughobrien4436
      @hughobrien4436 7 років тому

      revert to version 1.4.7 and it will work.

    • @SiddharthPant
      @SiddharthPant 6 років тому

      I am able to in 1.5.9 after I changed the declaration from class to interface for TopicRepository

  • @rickhunter8216
    @rickhunter8216 4 роки тому

    ARE YOU USING JAVA 8?

  • @muralithatholu2113
    @muralithatholu2113 3 роки тому

    how to add findbymail

  • @opendojo929
    @opendojo929 6 років тому

    I had errors because I wasnt using the JDK 1.8

  • @sasirajpuvvada4896
    @sasirajpuvvada4896 4 роки тому +1

    Field topicRepository in aaa.topic.TopicService required a bean of type 'aaa.topic.TopicRepository' that could not be found.
    The injection point has the following annotations:
    - @org.springframework.beans.factory.annotation.Autowired(required=true)
    Action:
    Consider defining a bean of type 'aaa.topic.TopicRepository' in your configuration.
    help me...

  • @xobzx
    @xobzx 4 роки тому +1

    stackoverflow.com/questions/45322941/schema-sa-does-not-exist-and-dropping-table
    Fixed some @Entity issues

  • @gudvibes455
    @gudvibes455 7 років тому +3

    Here's the dependency we need to add to pom.xml if you are not seeing this import "javax.persistence.Entity"
    org.springframework.boot
    spring-boot-starter-data-jpa

  • @garethsanashee1826
    @garethsanashee1826 5 років тому

    If ENTITY is not working for you. Try adding this to the POM:
    javax.xml.bind
    jaxb-api
    2.3.0

    • @deepakshano8485
      @deepakshano8485 4 роки тому

      I like the complete tutorial,
      Now my concern is about the join quires using jpa please reffer a tutorial where i can learn complete jpa

  • @carlosdudujunior
    @carlosdudujunior 4 роки тому

    Fiz um texto para ajudar a comunidade link.medium.com/2DrKLUHgZ8

  • @AlejandroFedorov
    @AlejandroFedorov 3 роки тому

    херня бесполезная

  • @ghouspasha7358
    @ghouspasha7358 3 роки тому

    You don't cover complex concepts which are actually used in business. all your videos are just hello world basic examples and you give a lot of theoretical information which makes the session boring. I would suggest you make videos on some complex scenarios of business.