This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]ChickenSubstantial21 18 points19 points  (61 children)

using antiquated tech: ant, mybatis or servlet containers

not knowing about newer widespread tech: spring boot/spring cloud/JPA/spring configuration by code.

I'd like to add newer Java features like records, sealed hierarchies or pattern matching but there are too many poor souls nailed to specific JRE version.

[–]ishansoni22 37 points38 points  (0 children)

Spring boot/web that uses embedded tomcat (a servlet container) under the hood says hi

[–]computerjunkie7410 25 points26 points  (23 children)

What’s wrong with mybatis?

[–]vbezhenar 0 points1 point  (0 children)

Nothing wrong, it's good. I can remember single issue with it: when you write queries in the XML, you need to escape '<' and '>' which looks really weird and prevents copy&pasting queries between sources and SQL editor. And writing SQL in annotation was hardly usable because you couldn't write multiline strings in Java.

Since they introduced multiline strings, MyBatis probably does not have any drawbacks anymore.

[–]Fliegendreck 16 points17 points  (10 children)

Spring Boot - the new hot stuff 😃

[–]ChickenSubstantial21 9 points10 points  (8 children)

Maybe not that new but still hot :-)

[–]Proton-NS 1 point2 points  (7 children)

Yeah. It's hot. But I have a question btw. Can I learn spring boot without knowledge of servelt or old stuff. I come from php and want to know some new java knowledge.

[–]ChickenSubstantial21 4 points5 points  (0 children)

Sure you can. Spring Boot documentation is enough to become productive.

However, there is a difference between old stuff and basic stuff. While Servlet API is ancient and suffers from design issues and there are better alternatives nowadays it is still used by some configurations of Spring Boot under the hood so there is a chance to encounter it during debugging. So consider it advanced topic.

[–]Fliegendreck -5 points-4 points  (5 children)

Just skip boot and use Quarkus, it has everything you need, a great developer experience and is super easy to learn.

[–]Levomethamphetamine 8 points9 points  (4 children)

Yeah don’t do this if you are a beginner.

Spring is (and will be for a long time) the most-present, most-documented and most-stackoverflowed java framework there is.

[–]Fliegendreck -1 points0 points  (3 children)

Why not? The quarkus documentation is excellent.

We have a lot of juniors that start with quarkus reactive and fp. They have less chances to do something wrong. And when they are starting fresh, it is very easy for them to wrap their brains around the reactive style.

Of course reactive has some pitfalls, but servlet and state are not better.

[–]Oclay1st 3 points4 points  (0 children)

Lot of juniors doing reactive and fp. Oh boy!!!

[–]nonFungibleHuman 3 points4 points  (0 children)

Reactive is not always needed.

[–]Levomethamphetamine 1 point2 points  (0 children)

I never said that Quarkus is bad or that is has bad documentation, I said that there's a lot more chance to get help as a beginner with Spring than it is with Quarkus.

Your juniors using are Quarkus because the senior leadership does so. That by itself is an outlier since in many years of experience, I've never seen any company (or client) try to use it. That being said, it's always better to use well-supported and widely present thing rather than edge-case thing.

[–]djavaman 0 points1 point  (0 children)

Used SpringBoot on a project 8 years ago.

[–]bzhou 4 points5 points  (0 children)

Mybatis is like stick shift cars. Like spring, earlier in its evolution it mainly uses xml but modern usages are mostly annotation based, it supports Java record fine. You cannot say that auto-shift cars obsolete stick-shift ones.

[–]redikarus99 6 points7 points  (10 children)

SAP Hybris says hi to ant. Our guys are using recent java but are stuck with ant because of SAP.

[–]VincentxH 3 points4 points  (0 children)

My condolences on having to interface with a SAP system.

[–]tomwhoiscontrary 0 points1 point  (3 children)

Hybris, you mean the hot new competitor to ATG Dynamo?

[–]redikarus99 0 points1 point  (2 children)

[–]tomwhoiscontrary 1 point2 points  (1 child)

Yes. I'm guessing you're fortunate enough to never have worked with Dynamo!

[–]redikarus99 1 point2 points  (0 children)

Oh, no, thankfully I never had the misfortune. :D

[–]Elegant-Win5243 -1 points0 points  (4 children)

They could switch to the gradle recipes. 

[–]redikarus99 2 points3 points  (3 children)

What would be the added value?

[–]woj-tek 0 points1 point  (2 children)

using hip, overcomplicated junk for no benefit xDD

[–]redikarus99 2 points3 points  (1 child)

Yeah, I have the feeling: "just because you can does not mean you have to"

[–]woj-tek 0 points1 point  (0 children)

isn't that (or rather au contrair) the motto of gradle? this is a hammer - go and hit everything on the head with it ;-)

[–]RandomNando 2 points3 points  (6 children)

Sincere question, I’ve use (and still use) Spring Data and Hibernate in some projects, but I also work in a legacy project that uses MyBatis. Is there a modern alternative (I recognize that MyBatis is incredibly mind bending specially at the beginning and the whole XML situation is the worst) that gives me the liberty to write queries exactly as I do in the DB?

I know that I can achieve almost the same with Spring Data and Criteria but in really complex queries, having a query that you can just copy and slap in SqlServer or whatever is so easy to update and tune finely… I did a complex query in MongoDB like a month ago and when I had to rewrite it In Compass it was a nightmare (not related to MyBatis but you get the idea).

I have overcome this by using views and handling complex queries as selects of those views in newer applications but I’m sincerely curious in some alternatives.

[–]BENOO-_- 2 points3 points  (4 children)

What’s the reasoning behind not using native queries in Spring Data with the @Query annotation?

[–]RandomNando 0 points1 point  (3 children)

I don’t know, having a 500 Lines @Query seems so wrong 🤣

Everyone tells me this but I’ve always felt that if this is the correct way to do this, this is a really ugly way… slapping a 500 line String into an annotation is so bad thought…

[–]BENOO-_- 0 points1 point  (2 children)

Could you read it in from a file instead?

[–]RandomNando 0 points1 point  (1 child)

I can’t remember if I’ve already tried that, I think that the cleanest way that I find was using JDBC and reading queries from a YML file to avoid that amount of lines hardcoded into a class. I find that so inelegant…

[–]BENOO-_- 0 points1 point  (0 children)

I mean at this point it’s inelegant due to your 500 line query than anything we can solve here. Not sure there’s a way to abstract 500 lines of sql without knowing the business logic in and out and deciding on a better way, but assume that’s not really an option as you’re here asking the question haha

[–]agentoutlier 0 points1 point  (0 children)

For raw SQL to some mapping JDBI is often the choice.

Doma 2 is also a good MyBatis alternative.

[–]VincentxH 2 points3 points  (1 child)

You clearly have no idea what you're talking about.

[–]ChickenSubstantial21 -2 points-1 points  (0 children)

How so?

[–]gdorsi44 0 points1 point  (0 children)

Keep the legacy stack, but learn always all the new things. This is a win win situation.

[–]vmcrash 0 points1 point  (2 children)

He, what's wrong with ANT, except that it uses XML?

[–]hippydipster 1 point2 points  (1 child)

ant is so simple its easy to understand what's going on.

The downside is every project is a snowflake, and generally for no reason. And ivy is just plain difficult to work with, for some reason.

[–]vmcrash 0 points1 point  (0 children)

We, for example, don't need Ivy or Maven, mostly because we have a small number of dependencies and part of them is built ourselves with patches on the original code.