r/learnjava • • Nov 10 '22

Java, Spring programming NSFW

Hello guysšŸ‘‹šŸ¼ I’ve been learning Java for about 3weeks now from YouTube videos , I’ve mastered some basic concepts but I don’t understand stuffs like Spring, web services, hibernate, JPA. I feel like I’m not going forward just standing still and it’s heart aching. I’d really like to get a complete Java roadmap from beginner to advanced. Anyone willing to mentor a beginner? for accountability and guidance...I’d appreciate, thanks!

50 Upvotes

25 comments sorted by

View all comments

1

u/[deleted] Nov 11 '22

[removed] — view removed comment

1

u/Geekfest65 Nov 11 '22

I would definitely not recommend learning jdbc to anyone. It’s just fraught with issues in terms of writing clean code , ensuring you close statements, close resultsets, close connections. It’s just too easy to mess this up.

This is something that Spring hides from you! You can use Spring JDBC. This is a much better way of working with data, and there are TONS of tutorials.

To me though, it’s still way too much coding. I prefer mybatis which maps methods to sql statements in an xml file. There really isn’t even a need for the xml file, it’s just something I like. With mybatis and Spring , you can autowire a data tier that performs crud against a multi table application, even writing your own code , and all the sql in about 2 weeks or less. This statement is based on a previous experience I had converting a proprietary data tier to Spring and mybatis. There are also tons of examples on this. There are full blown web apps on this too, like Pet Clinic.

So, even for a newbie, I’d say it’s best to ask about frameworks and how they’ll make your life easier. That may cause a lot of opinions but as long as they provide pros and cons, they are fine.

If you use Spring and mybatis, you don’t worry about connection management, pooling, closing anything, reading resultsets into pojos, etc, even complex resultsets. The only downfall with mybatis is you can list properties to map data that don’t even exist in the bean. Then you wonder why things are null. You can leave a semicolon in the xml file and it won’t load the data tier…. So, not all roses.

This is not to say learning jdbc is bad, just not worth the time when things do it better.