stop using H2 in memory-database RIGHT NOW

  Рет қаралды 33,854

Amigoscode

Amigoscode

Күн бұрын

Пікірлер: 96
@ChandlerBing11
@ChandlerBing11 Жыл бұрын
Hey, Nelson, you could record a tutorial teaching How to configure this AbstractTestcontainers and all that stuff to replace H2 DB. That's really useful, your videos are amazing
@АлександрДмитриев-ч7ш
@АлександрДмитриев-ч7ш Жыл бұрын
I would like to watch that video)
@amigoscode
@amigoscode Жыл бұрын
Will do
@netmarvintube
@netmarvintube Жыл бұрын
Good idea!!!
@stefanoriffaldi84
@stefanoriffaldi84 Жыл бұрын
@@amigoscode thanks man
@asjjain191183
@asjjain191183 Жыл бұрын
Whatever you are talking about, maybe true for complex projects or high data loads. But 90% of projects have very simple crud operations. Anyhow, it's not always about unit testing. Before going to production, usually, code is tested by QA, performance, load testing, security team and UAT. with h2 database writing test cases is easy.
@kelvinbirikorang1877
@kelvinbirikorang1877 Жыл бұрын
I still think H2 in testing is fine, if you ain't performing limited / any database-specific functions. Spinning up docker to run something simple during integration test, hmm it seems overkill
@taiwan-peko
@taiwan-peko Жыл бұрын
I have also encountered situations where the testing results of H2 Database and PostgreSQL are different. This video has further convinced me that H2 should not be used. Thank you for sharing.
@andreiisachenko6755
@andreiisachenko6755 Жыл бұрын
Hello, Thank you for the video. I have 7+ years production expedience and want to add few moments which i learned). So better a bad test than no test). Yes h2 is not totally equal to production ready databases and what works on h2 might not work on MySql,Postgres... But it is
@sadeepaalwis5938
@sadeepaalwis5938 Жыл бұрын
Loved the video Nelson please do a tutorial on TestContainers and setting it up a little in depth ❤ Thank you!
@hotshotgolfer3079
@hotshotgolfer3079 Жыл бұрын
Love the way you teach! I just finished my first h2 todo project. But I am from PHP and MySQL so I needed some instruction on host to get a MySQL database with the JAVA project instead of H2. This was a little over my head. I am off to your website to see if you have a course that might fit my level a little better. TY!
@axslv
@axslv Жыл бұрын
While H2 is not recommended sometimes using it is the only way to have your tests. For example, the most recent client of ours provided us with their CITRIX vms, so this rendered both docker and testcontainers impossible to use. What I want to say is that we need H2 in order to cover ignorance of our clients. So again, when we have "theory" VS "real world" problem. Thanks for this video!
@RochaNahuel
@RochaNahuel Жыл бұрын
I am studying his course from two years ago on JUnit testing and he recommends using H2, in fact he is teaching it, at that moment the thumbnail of this video came to mind, now I don't know if I should learn like this or not...?
@kirasign4605
@kirasign4605 Жыл бұрын
Thank for granting my wish, amigo! I know this video is just not for me but I am also one of the people who requested it. Even in your big time of fasting 🥰
@MrBrackets
@MrBrackets Жыл бұрын
really great Nelson! Thank you so much for sharing. I've been following you since the beginning and I can say your content helped me a lot on my career, I'm an amigoscode fan definitely haha. I really want to buy the Full Stack Professional course but right now my budget is a little tight, would be awesome to get a magic coupon code. Thank you so much for everything, you're an inspiration to me!
@michelchaghoury9629
@michelchaghoury9629 Жыл бұрын
We need more videos about testing and about Test Containers and Integration Testing. Please can you in the future make tutorials about Spring Boot Reactive?
@zhenka1982
@zhenka1982 Жыл бұрын
I am a principal software engineer. I like a lot of your videos and give you props for explaining best practices to junior engineers in a clear and concise way. However, this video is an exception. Judging by the comments, nobody really understood your point. And I must say, your point is lost because for some reason you are talking about H2 and “in memory-database” like that’s something special. The only sensible thing you can say is that a test environment should as closely as possible mimic the production environment. Now that’s a true statement. What does H2 in particular have to do with the price of tea in china? Same would be true if you said “Don’t use Oracle to test MySQL queries”. Now, I get it, you are trying to say, that the ease of getting an H2 running makes it super easy to use for testing. But that’s largely irrelevant, for the point you are trying to make.
@xbuddhi2370
@xbuddhi2370 Жыл бұрын
Perfecto Amigo, we need the tutorials on test containers and all the testing stuff in spring boot soon. Love you ❤
@gaetanbayenay8730
@gaetanbayenay8730 Жыл бұрын
Hi, Just a quick comment... In general in Java world, you should use JPA and Hibernate (or similar) to handle DB. So, as far as you're using this abstraction, there is no big deal to use H2. And by the way, the use of custom DB functions is discouraged. Better to stay with "standard SQL" (or similar from Hibernate). So it means it's perfectly safe to use H2 to make some kind of unit tests, for instance those that ensure the correct lazy loading or the persistence effectiveness, your real (basic)persistence logic, etc... And it's not replacing integration tests with whatever DB you want... An advantage to H2, is the possibility to launch directly some SQL script in the connection String. That way, you can initialize a database correctly (with specific SQL like the one that was created by the DBA). True story, if I was not trying to use H2 on one of the project I collaborated, then I never been able to detect fundamental PROD DB problem. It was precisely because I forced myself to standardize things through JPA and Hibernate, and validated both local H2 and other environment Oracle that I found some previous migration was not completed correctly... I'll not advocate to use H2, I'll just wanted to say it's another great tool that can be used. It's a little unfair to say it's not safe, if you pay attention to the limitations...
@maksym.pavlenko
@maksym.pavlenko Жыл бұрын
Correct me if I'm wrong, but in case if I cannot avoid using a feature provided by a custom DB function, I'd use it, rather than inventing a wheel by implementing it myself and putting a responsibility of supporting this logic on my team
@gaetanbayenay8730
@gaetanbayenay8730 Жыл бұрын
@@maksym.pavlenko, I'll say that you can maybe challenge the real necessity to have the custom DB function. And well, if it's really not possible to do without this custom function, then there is no reason to not use it. It's just that you can "skip" the particular part that use the custom function by skipping the H2 test, and try to have unit tests / integration tests with H2 for everything else. Then it's a matter of isolation, more than avoiding custom DB functions.
@maksym.pavlenko
@maksym.pavlenko Жыл бұрын
@@gaetanbayenay8730 all this comes from unreliability of such functions or the fact the migration to another DB without unsupported functions could be easier?
@gaetanbayenay8730
@gaetanbayenay8730 Жыл бұрын
@@maksym.pavlenko I think it's more complex than that. If the goal is to have the ability to change DB, then the standardization is a must. So, higher expectation means to think about the problem (and the way the data are stored) differently. It's not only the pure data, or the way to handle them, but also the meaning of the data organization. That's the reason why it's important to challenge the real need for custom function. Another point is how to deal in code with the data. If a custom function can be avoided by using similar data manipulation within Java (for instance with java streams), or by rethinking the separation of concerns with a split into microservices, then it's also a valid answer to the problem. And maybe it's the DB technology itself that can be changed (by using non relational DB, or something totally different). So, there is room to avoid custom functions, depending on the needs and the liberty in adressing the problem... :) ... But at the end, if the functions exists, there is a need too, and good reasons to use them, with the knowledge that the code is no more standardized.
@sadiqshaikh8715
@sadiqshaikh8715 Жыл бұрын
Hey amigo i just wanted to let you know I got into software development recently and you have been a great help keep up the good work man❤
@kalden.s814
@kalden.s814 Жыл бұрын
Yes please make a video on testing (for controller, repository and service layer). I don't understand how to test😢 I can write code but i cannot write tests for it😑
@shayuru
@shayuru Жыл бұрын
It sounds fine, but it works on the Development environment (local), but this cannot be easily done over automated CI/CD, e.g. Jenkins or GitHub Actions, it is possible but requires extra resources and configuration and create a dependency on the database (must be running before the test), UTs are supposed to be isolated. that's why mock libraries were created, I understand your point I've created UTs that run against a "real" database, but I've disabled them when running the automated CI/CD because I cannot modify the "DevOps infrastructure" just to run containers.
@RzariRzari
@RzariRzari Жыл бұрын
I mean, this is why we use abstraction. DBs might have differences, but we should develop app as flexible as possible. So using H2 is good if it’s justified. If we use some specific function from PostgreSQL in out test, maybe we should consider changing it
@pasvupaspris303
@pasvupaspris303 Жыл бұрын
solid point
@bryceblankinship
@bryceblankinship Жыл бұрын
Ran into this at work recently. H2 dialect for Oracle isn’t complete and it was literally impossible to test my DAO and had to mock it… which is useless!
@geni4551
@geni4551 Жыл бұрын
Thank you. Would love to see the TestContainers video
@alaeddingarraoui4538
@alaeddingarraoui4538 Жыл бұрын
THANKS Nilson, always wonderful video ! . I'd love to make a video on how to use docker to replace H2 cos right now I'm learning it, and still I'm not quite sure to understand how to use it in a concrete project like this your project.
@jqwerty296
@jqwerty296 Жыл бұрын
Hi Yes we need this video about containers.
@hovasty
@hovasty Жыл бұрын
Great video. Please show us how to do test containers :)
@marianacagnoni3205
@marianacagnoni3205 Жыл бұрын
we're all waiting for the testing containers tutorial sir thanks for the good content!
@trustDproc3ss
@trustDproc3ss Жыл бұрын
Thanks for this, this approach is good for developer using docker.
@aminesafi7261
@aminesafi7261 Жыл бұрын
Great content, keep going bro!
@simbarashemaunga5575
@simbarashemaunga5575 Жыл бұрын
This may trigger someone but I say it in good faith. Consider setting a poll on whether or not you should continue with these new thumbnails where you look shocked/confused etc vs the legendary thumbs up.
@elhadjbabacarcisse2868
@elhadjbabacarcisse2868 Жыл бұрын
Hello Nelson, thanks as usual. Can you make a video on TestContainers and your configuration? Thanks mate
@pierrelaurensflorez2273
@pierrelaurensflorez2273 Жыл бұрын
Hey Nelson! Good video. I would like to see a TestContainer tutorial on using it, and I have a quick question. If I'm using an interface that implements JPARepository without using custom queries, should I need to write unit test for the original operations? Should I test the interface? Or should I create a class that implements my custom interface and then create a unit test for this new class? I really appreciate this video Nelson!!
@felipepedrosa6220
@felipepedrosa6220 Жыл бұрын
Isn't necessary to test this JPA interfaces, You'll need to test it just in case of having custom queries. All "default" queries are tested over years by spring community :)
@patryktraczyk3246
@patryktraczyk3246 Жыл бұрын
AbstractTestcontainers would be really great to see! Hope you can prepare such material soon 😀
@slota4
@slota4 Жыл бұрын
yes, please make some example how to setup TestContainers, how to use it :) will be helpful for sure.
@DevLearn-lv7nr
@DevLearn-lv7nr Жыл бұрын
H2 is absolutely fine for QUCK testing, without going to the effort of a "near to production as possible" environment
@hetman78182
@hetman78182 Жыл бұрын
I would also like to watch a video about testcontainers, especially with spring boot 3.1
@zhandosyernazarov3086
@zhandosyernazarov3086 Жыл бұрын
Hi, I would love to see a video on setting up TestContainers
@MarcioJustoDev
@MarcioJustoDev Жыл бұрын
Please Nelson! A video for testcontainers, including with kafka reactive! hands 🙏🏾
@adrianilie28
@adrianilie28 Жыл бұрын
Yes! Please! I'm interested in Testcontainers :)
@danielkirsch4351
@danielkirsch4351 Жыл бұрын
Awesome Nelson, testcontainers vid pleeeese!😊
@maulikdavra389
@maulikdavra389 Жыл бұрын
Dear Nelson If you are opposing of using H-2 in first place then why haven't you updated your course "software testing" (listed on your website) which uses H-2 db. On top of that throughout the course you are mocking repository layer and injecting mock on service layer. If this is not the best practice to follow then why you haven't you updated this course with docker implementation. H-2 is quite good with basic CRUD operations but docker is one of the safe and reliable option for testing. Please record a video for unit as well integration testing with docker test containers. At least this would help me learn all the major concepts of software testing. But I am still not clear if mocking service layer or repository layer is OK for isolation testing or even unit as well as integration testing! what type of testing practices an enterprise company follows ?
@Muescha
@Muescha Жыл бұрын
please do a deep dive tutorial into testcontainers
@RochaNahuel
@RochaNahuel Жыл бұрын
You should update your JUnit course from 2 years ago where you literally recommend using H2 , or add some notification in that video.
@ainigma100
@ainigma100 Жыл бұрын
Thank you for the great video!
@arvikv
@arvikv Жыл бұрын
yes, we want to see how to use testcontainers from scratch, plz
@georgepro8481
@georgepro8481 Жыл бұрын
Hello, Nelson! Is it possible to launch testcontainers automatically before tests start? And stop it after?
@aleksandarivanov8824
@aleksandarivanov8824 Жыл бұрын
Great video! I would like if you could put a video from scratch about test containers.
@tarikmujcic2966
@tarikmujcic2966 Жыл бұрын
It would be REALLY good to have the video on test containers
@rafabanasiewicz3074
@rafabanasiewicz3074 Жыл бұрын
Hey Nelson! Where can I find your code formatter setup? Also I’m staying with dillema which MacBook Pro is best For fullstack oriented programming with a budget of 2k$ (prefer 14’ ones) It will be better to buy M2 Pro or M1 Pro with upgraded RAM? Or maybe other one with Intel processor?
@NakMs
@NakMs Жыл бұрын
For the container db test, it quite take time when run.
@akashranjan930
@akashranjan930 Жыл бұрын
Hey Nelson! can you make tutorial on SpringAOP, couldn't really find any perfect explanation
@andresnator
@andresnator Жыл бұрын
Thanks for your videos
@sirfinsaan
@sirfinsaan Жыл бұрын
what about external service ? should we mock or any other approach
@antonpirulero2836
@antonpirulero2836 Жыл бұрын
Why? h2 is excellent to teach the basic of SQL without messing with a db install. H2 is not designed for a production serious enviroment. Learn the basic of ORM, SQL, JDBC and then kick off the H2 if you want.
@TheUrizen
@TheUrizen Жыл бұрын
I have been trying for weeks to create the simplest application: something that creates users and saves it into an H2 database. But for some godforsaken reason, all POST requests made to the register endpoint return a status 200 instead of a 201, so nothing is ever created on the database. Why? I have asked everyone, from teachers and professionals, to chat GPT and no one seems to find the answer. I'm beginning to think the issue may be related somehow to the H2 database. I see no other explanation.
@antonpirulero2836
@antonpirulero2836 Жыл бұрын
@@TheUrizen ... its a conspiracy ...
@zakharborisov1841
@zakharborisov1841 Жыл бұрын
Should I mock repository in service layer? If I tested custom queries of repository using testcontainers?
@azeemcr37
@azeemcr37 Жыл бұрын
Need TestContainers video 🔥🔥🔥🔥
@Muescha
@Muescha Жыл бұрын
how you have automated the firework at the end of the tests?
@0107007
@0107007 Жыл бұрын
Hi! What do you think about using SQLite as an alternative to H2? I know it has similar limitations but if the application is small or simple it may works well, right?
@johndoedoejohn
@johndoedoejohn Жыл бұрын
I guess mongoDb would be good option with mongo atlas, but it's nosql
@zakariaeelbouayadi3222
@zakariaeelbouayadi3222 Жыл бұрын
Assalamu alaykum and Thank you very much
@ammanul543
@ammanul543 Жыл бұрын
Hi i had one doubt can't we use mockito instead of actual database call?
@GM_stokes
@GM_stokes Жыл бұрын
That’s cool but when I try it on my PC, with an Oracle test container, it takes 2 minutes to run a single test
@arturxavier1481
@arturxavier1481 Жыл бұрын
But how would I setup the docker in a CI environment?
@marcosdantasguimaraesfilho7747
@marcosdantasguimaraesfilho7747 Жыл бұрын
Please do record a video on setting up TestContainers! That's soooo useful!!
@eugensmuscle
@eugensmuscle Жыл бұрын
The H2 technology is used by many book authors to explain concepts. I have never liked this foolish approach, and I am happy to see someone who thinks like me for the first time.
@ayoubelhioui2205
@ayoubelhioui2205 Жыл бұрын
is that means H2 has no use cases? can you explain why did you call it foolish approach?
@IndritVaka
@IndritVaka Жыл бұрын
The video was great, but why you have to add that rainbow??
@Rostik_13
@Rostik_13 Жыл бұрын
"How to configure this AbstractTestcontainers and all that stuff to replace H2 DB?" Just do it, please😎👊
@radecki125
@radecki125 Жыл бұрын
we want to see testcontainers!
@trocandobytes
@trocandobytes Жыл бұрын
What about SQLite ?
@darioanguilla3147
@darioanguilla3147 Жыл бұрын
Testcontainers deeply from scratch please!
@FredrickIrubor
@FredrickIrubor Жыл бұрын
Docker is a life saver
@LifeOfMohammed
@LifeOfMohammed Жыл бұрын
This is not ideal for tests though as with tests I run them on an environment that doesn't have a database instead just uses the memory database
@zombi1034
@zombi1034 11 ай бұрын
Easy solution. Just use H2 in production😎
@tepchiva8342
@tepchiva8342 10 ай бұрын
Could you please publish source code?
@nandux586
@nandux586 Жыл бұрын
Hey man. I appreciate your content, but the thumbnails are kind of off putting. 😬
@daniel_goncalves
@daniel_goncalves Жыл бұрын
Show how tô do this
@felipe1876
@felipe1876 Жыл бұрын
Ok. I promise that. Can you hire me?
@haltsmaul.
@haltsmaul. Жыл бұрын
I'm developing a small application that uses an H2 DB and got real spooked 😳.
@maximilianh7728
@maximilianh7728 Жыл бұрын
hey amigoo
@Abrahhhhh
@Abrahhhhh Жыл бұрын
First🎉🎉🎉
@sadiqshaikh8715
@sadiqshaikh8715 Жыл бұрын
Second🎉
@AmigoscodeFree
@AmigoscodeFree Жыл бұрын
You can have his course for free. Dont buy his overpriced course
@NEMOBANDZBEATS
@NEMOBANDZBEATS Жыл бұрын
If you get a lot of value from his content why not show some support ?
@AndriiKovalov
@AndriiKovalov Жыл бұрын
I agree that nowdays it is a best practice to use testcontainers to have best compatibility across all environments. But for those who stuck with H2 for any reason, keep in mind that you have some flexibility by creating aliases for Java based functions, ie: CREATE ALIAS IF NOT EXISTS TRUNC FOR "my.package.MyH2Functions.trunc";
Junior Developer Sent Me Another PR For Review
15:44
Amigoscode
Рет қаралды 105 М.
Amazon MemoryDB for Valkey: Fast In-Memory Database Setup in 10 Clicks!
14:55
Thank you mommy 😊💝 #shorts
0:24
5-Minute Crafts HOUSE
Рет қаралды 33 МЛН
«Жат бауыр» телехикаясы І 30 - бөлім | Соңғы бөлім
52:59
Qazaqstan TV / Қазақстан Ұлттық Арнасы
Рет қаралды 340 М.
Counter-Strike 2 - Новый кс. Cтарый я
13:10
Marmok
Рет қаралды 2,8 МЛН
the right way to organise your code
17:33
Amigoscode
Рет қаралды 205 М.
#18 Spring Data JPA and H2 Setup
9:25
Telusko
Рет қаралды 33 М.
Testcontainers have forever changed the way I write tests
12:11
Dreams of Code
Рет қаралды 126 М.
10 Spring and Spring Boot Common Mistakes You Need To STOP
15:49
Amigoscode
Рет қаралды 164 М.
Using SQLite with PowerShell
16:33
Bryan Cafferky
Рет қаралды 10 М.
JAVA DTO Pattern Tutorial | Simplify Your Code
19:12
Amigoscode
Рет қаралды 223 М.
H2 Database Basics
10:30
Developer Soapbox
Рет қаралды 34 М.
10 Signs Your Software Project Is Heading For FAILURE
17:59
Continuous Delivery
Рет қаралды 37 М.
You've Been Using Java Strings WRONG All This Time!
9:15
Amigoscode
Рет қаралды 91 М.
Robot 🤖 cleaning 🧹
0:57
Bunnal 𝚃𝚎𝚌𝚑
Рет қаралды 4,7 МЛН
Самые простые строительные леса
0:54
Канал ИДЕЙ
Рет қаралды 1 МЛН
ПОСТАРЕЛА ЗА 1 ДЕНЬ НА 20 ЛЕТ - МУЖСКОЕ ЖЕНСКОЕ
55:44
ПРИЯТНЫЙ ИЛЬДАР
Рет қаралды 677 М.
Американцы красят асфальт?
0:27
BAZAR CLUB
Рет қаралды 188 М.
DID YOU NOTICE ANY LAPSES IN THE VIDEO or NOT? / MARGO_FLURY
0:34
MARGO FLURY | Маргарита Дьяченкова
Рет қаралды 12 МЛН