Java Spring Boot - JPA - H2 In Memory Database Configuration - Persisting Entity

Поделиться
HTML-код
  • Опубликовано: 18 ноя 2024

Комментарии • 46

  • @Aqwsaful
    @Aqwsaful 2 года назад +1

    Thank you Maaan!! You did what i have been looking for so long. Please keep doing your job! It is really valuable!!

  • @hoatieu6936
    @hoatieu6936 4 года назад +2

    the tutotial is absolute clear and understandable.. I could build and run the project with textpad, and in command prompt. Thank you Very Much!

  • @changtai02181
    @changtai02181 3 года назад +2

    Thank you, I learned a new way of writing from your video. I am very appreciated it.

    • @CodeForgeYT
      @CodeForgeYT  3 года назад

      Hey! Glad to hear that! Keep coding!

  • @MrBiswajitroy007
    @MrBiswajitroy007 2 года назад +2

    Great Explanation

  • @chaimaeramdani1728
    @chaimaeramdani1728 4 года назад +2

    Thank u so much i was having a lot of troubles to do this connect thing you'rea savior

    • @CodeForgeYT
      @CodeForgeYT  4 года назад

      Great to hear that! Thanks for the feedback!

  • @jonathancolorado2998
    @jonathancolorado2998 2 года назад +1

    Thanks your help me in this moment, is a great help for me

  • @securethebag1613
    @securethebag1613 10 месяцев назад +1

    is it possible to use hikari with an in memory database like h2 just to test the pooling?

  • @jevgenijkornev3641
    @jevgenijkornev3641 3 года назад +5

    Your explanation is so good, thank you very much!

  • @pawelnowak7532
    @pawelnowak7532 2 года назад +2

    Thanks man for this awesome tutorial!

  • @JaanM-y7i
    @JaanM-y7i 6 месяцев назад

    Hi!
    Please advise why did you decide to place fileDb in './data/fileDb' (spring.datasource.url=jdbc:h2:file:./data/fileDb) ?
    Could it be in './src/main/resources/data/fileDb' folder?
    Is there any difference?

  • @oliverantalfekete9966
    @oliverantalfekete9966 3 года назад +1

    Nice explanation! Love ya!

  • @fithawighide6589
    @fithawighide6589 3 года назад +1

    Thank you I like your explanation

    • @CodeForgeYT
      @CodeForgeYT  3 года назад

      Glad you like it! Thanks for watching!

  • @dinobulja
    @dinobulja 3 года назад +2

    also, if you use SpringSecurity, in your WebSecurity.configure method to configure HttpSecurity, add .antMatchers("/h2-console/**").permitAll() (if your h2 console path is default "/h2-console", if not change to your path, in this video, it would be "/h2/**".

  • @MegaVito555
    @MegaVito555 4 года назад +1

    Wow! Super clear helped me a lot!

  • @Worexon
    @Worexon 2 года назад

    Hi!!
    It works for me with jdbc:h2:mem:test
    but when i try to store the database in a file there is no table att all when i login in h2??
    Its a spring boot app with html form so i dont add throu java code.
    Any suggestion?

  • @surajghongate4120
    @surajghongate4120 3 года назад +1

    Awsome man.... Thank you

  • @azermirzayev648
    @azermirzayev648 2 года назад +1

    When I start the project, Hibernate makes all the tables and connection automatically. It works fine.
    if I run the query INSERT INTO ROLES (NAME) VALUES ('USER') first time manually in the h2 console, it inserts USER with ID 1 correctly.
    But if I run the query INSERT INTO ROLES (NAME) VALUES ('ADMIN') after the application restart, it inserts ADMIN with ID 33 instead of 2.
    The third run starts with 65 and so on.
    How could I achieve, that the ID continues from where it finished at the previous application run?

    • @CodeForgeYT
      @CodeForgeYT  2 года назад +1

      It is about configuring generation strategy of ID for specific entity. For example you can define sequence generation strategy with allocationSize=1.

    • @azermirzayev648
      @azermirzayev648 2 года назад

      @@CodeForgeYT i use @GeneratedValue(strategy = GenerationType.SEQUENCE).in your tutorial id is 33 after 1

    • @CodeForgeYT
      @CodeForgeYT  2 года назад

      @@azermirzayev648 Try to set allocationSize

    • @azermirzayev648
      @azermirzayev648 2 года назад

      @@CodeForgeYT i used ...allocationSize = 1. result same

  • @rajshekar4033
    @rajshekar4033 4 года назад +1

    hello codeForgeYT,
    Your videos are mindblowing , actually im making a small project can you help me regarding that project

    • @CodeForgeYT
      @CodeForgeYT  4 года назад

      Hey! Thanks for feedback! Glad you like it. Recently i don't have much time, but if you struggle with technical issue try to ask a question on stackoverflow. You can find there a lot of experienced developers willing to help.

  • @swellmar
    @swellmar 2 года назад

    I still can't reach the console in the browser. I have also tried configure HttpSecurity and all that. What is the issue?

    • @CodeForgeYT
      @CodeForgeYT  2 года назад

      Take any source code from github that I have shared and check if it works for you.

  • @AlexSanchez-zy3kw
    @AlexSanchez-zy3kw 2 года назад +1

    what IDE he did use?

  • @dinobulja
    @dinobulja 3 года назад +1

    I think you forgot to add property for h2Dialect use?

    • @CodeForgeYT
      @CodeForgeYT  3 года назад

      It is not mandatory to make it work, but for sure can be added

    • @dinobulja
      @dinobulja 3 года назад

      @@CodeForgeYT I had to add it

  • @ibrahimkamal9650
    @ibrahimkamal9650 2 года назад

    I couldn't connect to database via h2-console , I got this error : Database "mem:salam" not found, either pre-create it or allow remote database creation (not recommended in secure environments) [90149-214] 90149/90149 (Help). How can I fix it?

    • @loken503
      @loken503 2 года назад

      Hello, you should delete DB_CLOSE_DELAY=-1 line and all will work well

  • @viviannedemoraes3720
    @viviannedemoraes3720 2 года назад

    Exception in thread "restartedMain" java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)
    Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.repositories.DiscoRep' available
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:351)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:342)
    at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1172)
    at com.example.demo.Yes1Application.main(Yes1Application.java:18)
    ... 5 more

    • @viviannedemoraes3720
      @viviannedemoraes3720 2 года назад

      Fuck it, it was the folder structure, how could something so petty have made me waste so much time figuring out the exception? :((((