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 !!
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.
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.
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
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 :)
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
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.
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!
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.
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.
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
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?
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.
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..
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 ?
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?
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 ?
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?
# 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
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!
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
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. :)
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?
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.
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.
Field topicRepository in io.javabrains.springbootquickstart.topic.TopicService required a bean of type 'io.javabrains.springbootquickstart.topic.TopicRepository' that could not be found. problem
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...
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
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.
Definitely the best and clearest explanation I have found - and I've looked everywhere!
I can't express how perfect this explanation is, not too much, not too little, exactly the right info for the task. Thank you!
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 !!
Thanks a lot for the best and clear explanation ever. The idea of making the videos short keeps it going. Thanks again.
This tutorials are insane. You are very well explainer! Thank you very much!!!
Extremely well explained, thank you!
very well explained. Good effort.Appreciated.Thanks !!
Thanks for all your videos it is really helpful ..and Explaind very clearly love you bro.
Thank you Rajesh, great video
Nice step by step for start-up learning
Brilliant explanation, very intuitive, thank you !!
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.
life saver
Very well explained, very clear english accent, Thanks
HAHAHA
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.
Thanks for such a lucid explanation
can someone please help on the Bean error? It says it cannot find the bean for the interface..
By far the best Explanation!!
Just all i needed 🥰🥰 thank you a lot
Beautifull explantion Sir..Thank you..
Why do I go to college if I can just watch all of your content...... Thank you so much! Great work
very good and brief content!! KUDOS
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
Loveeeeed, thanks!!!
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 :)
It solved for me: change from "import org.springframework.data.annotation.Id;" to "import javax.persistence.Id;"
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
Did the same mistake
best tutorial, just end without notice.
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.
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!
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.
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.
Hi, can you do a project example with pagination / paging ?
may be a silly question but....the annotation you are using are provide by whom...Spring MVC?
Please do reply
thank you
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
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?
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.
derp haha thanks
this guy is great
is it possible multiple search with like in spring data jpa? if yes ..then how
pls help
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.
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..
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 ?
What to give as datatype of Primary key if the primary key is Composite?
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?
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 ?
i think so....
Hi there, which repository should we implement for Bigquery?
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?
HI am getting 404 error on GET/POST request
Plz help me out ?
spring boot jparepository just only can connection one table?
Is the saved data persistent? If I kill the server and start it again, will the data be still in my "database"?
At least on my machine the database is empty on every new run of the application.
# 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
Java Brains + Telusko, and you are good to go.
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!
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
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. :)
好东西!
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?
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.
crudRepository is an Interface, and in Java an Interface can extend another Interface, not "implements"
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.
I was using a newer parent version (3.0.1) I think. When I changed to 2.1.2.RELEASE it worked :)
please add this
"@EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class})"
in main class
You did not make any video on connection of actual database with Spring Boot
have you done this yet?
now it wont work if u didnt annotate ur interface which extends CrudRepo with @Repository
Field topicRepository in io.javabrains.springbootquickstart.topic.TopicService required a bean of type 'io.javabrains.springbootquickstart.topic.TopicRepository' that could not be found. problem
voice is different, teaching is same as always great
How to delete multi item
You can not import the necessary libraries for CrudRepository after Spring Boot version 1.5.4.
revert to version 1.4.7 and it will work.
I am able to in 1.5.9 after I changed the declaration from class to interface for TopicRepository
ARE YOU USING JAVA 8?
how to add findbymail
I had errors because I wasnt using the JDK 1.8
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...
how did you solve id please guide?
stackoverflow.com/questions/45322941/schema-sa-does-not-exist-and-dropping-table
Fixed some @Entity issues
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
Thank you very much for this.
If ENTITY is not working for you. Try adding this to the POM:
javax.xml.bind
jaxb-api
2.3.0
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
Fiz um texto para ajudar a comunidade link.medium.com/2DrKLUHgZ8
херня бесполезная
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.