Eliminate mongodb or couch’s hibernate / MySQL for Java / spring / Tomcat web applications

I have an application that is undergoing large-scale rework, and I have been exploring different options - adjusting "as is", redoing projects in different frameworks or platforms, etc

When I really think of it, there are three main things I don't like about Java:

>Server start / stop when modifying controller or other classes Dynamic language is a great victory for Java here. > Hibernate, lazy loading exceptions (especially during asynchronous service calls or Jackson JSON marshalling) and ORM inflation Hibernate itself is the reason for the slow integration startup time and extremely slow application startup time. > Java stupidity - inconsistent class loading problems when running applications in the IDE compared to Tomcat Once you solve these problems, you may never see them again Even so, most of them are caused by hibernate because it insists on using a specific ANTLR version, etc

After thinking about the problem... If I get rid of hibernate, I can solve or at least improve all three aspects

Have you ever redesigned 50 entity Java applications to use Mongo or sofa or similar databases? What was the experience like? Do you recommend it? Suppose you have some great unit / integration tests. How long will it take? Does the idea sound better than it actually is?

If I can store documents, my application will actually benefit in many ways It actually opens up some very cool and interesting features for the application But I do want to be able to create dynamic queries for complex searches... And I was told couch couldn't do that

For NoSQL databases, I'm really green, so any suggestions on migrating (or not migrating) large Java / spring projects will be very useful In addition, if this is a good idea, what books would you recommend for me to speed up and really use them in the best way to apply the application?

thank you

Solution

In any case, your roar includes not only the previous (traditional) decisions for hibernate, but also your development as a programmer

If a similar project is on my lap and is in urgent need of reconstruction or improvement, I will do so

It depends on the stage of the software life cycle and the time pressure involved if you want to make major changes or stick to smaller changes However, in the long run, incremental migration seems to be your best choice

It seems wise to keep applications written in Java for a short time, and major rewriting of another language is bound to undermine acceptance and integration testing

As Joseph suggested, move from hibernate to JPA It shouldn't take too much time From there, you can switch the back end to some other storage methods Try to solve the problem Choose the concept that looks best. Some people prefer MVC, others may choose cqrs, and others prefer another segmentation / separation method

Because the JVM supports multiple languages, you can always switch to any of them, or at least partially implement functions in a more dynamic language This will solve part of the problem that you continue to encounter Java's "stupidity" while still retaining the excellent optimization of the current JVM at runtime

In addition, you may want to set up automatic integration tests... Because you want to never run the application from the IDE, these tests will provide you with real results

Sidenote: if the IDE has the ability to inject its own libraries into the build or run-time path, I never believe that my ide can get dependencies correctly

In short: small steps; Lose hibernate and be more abstract to JPA; If Java becomes stupid, gradually turn to a smart language Your main concern is to refactor the code base without losing functionality. Remember, open design will make it easier to add interesting and cool functionality in the future

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>