-
Notifications
You must be signed in to change notification settings - Fork 6
Database setup #9
Comments
The database really doesn't matter that much, but I would prefer to use Hibernate since it's an in demand skill that is heavily used in Spring. Using hibernate you can use pretty much any database you'd like and setup is minimal. |
Hibernate is pretty far from writing SQL. If you want to learn SQL, JOOQ is probably quite a bit better. It is quite a bit simpler to use hibernate though, so maybe it is better suited for beginners? If you go the JOOQ route, you can also easily manage the schema with Flyway, with Hibernate that is a bit more fun, if I am not misinformed. Not quite sure |
I recommend to use Spring Data JPA |
sqlite and jooq seems like a reasonable choice, just the right amount of complexity to be useful experience for a new contributors aswell, unlike jpa enterprise black magic monstrosity |
Was there a final decision on how this was going to be implemented? I’d like to learn how the process works. |
Leslie said Thursday would be the decision. |
so 3 people people (including me) voted for jooq. So I think we should go with that, Im sorry to the others. But please implement any data access as Repository to make the dataaccess (jooq) exchangable. |
Just found out about this, I may be a little late for the party, but here are my thoughts: Spring is the industry standard and there is no debate about this, moving the project to Spring would be a huge plus. (but please, no XML BS.. #annotations) About the database, if you want something portable, H2 is by far the best.. Fully supported by Spring Data/JPA, also, it has an awesome webconsole embedded if the user wants to do stuff more visually. |
I'm also on the Spring-Train. There are a ton advantages you get by using Spring. But @thmalek i know someone is against Spring because its doing to much "magic". +1 Spring |
So we want to integrate a huuuge framework just to automate some very basic queries? |
The thing about Spring is that you won't be only using it for querying the database, there are other features like DI/IOC. Even if you pretend to exclusively do very simple CRUD operations (which is not the case), Spring still a good idea. Let's suppose that the community grows and now we have 50k members. Dealing with all modmail and reports through discord chat would be a mess, Spring MVC or WebFlux is one dependency away and your current code is already fully compatible. |
Look at this principle: We got some other project in consideration that would involve Spring for more experienced members. |
Ive got to supply my opinion too, I guess. I am against Spring for the sole reason that it will scare beginners away. Having them see hugely annoted classes or whatever, that, from their point of view, dont make much sense would be a terrible thing. One could, in theory, say the same about jooq. The only difference is that in jooq, the codebase is somewhat readable. If youve ever heard of or seen SQL queries you'll grasp it relatively fast. BookRecord book = new BookRecord();
book.setAuthorId(1);
book.setPublishedIn(1970);
book.setLanguageId(1);
// Using the explicit condition() API Result<BookRecord> books1 = DSL.using(configuration)
.selectFrom(BOOK)
.where(condition(book))
.fetch();
// Using the convenience API on DSLContext Result<BookRecord> books2 = DSL.using(configuration)
.fetchByExample(book) Seems pretty readable to me |
I guess after checking this out: It doesnt seem that far fetched. Also setup seems pretty straight forward - as stated the question should probably rather be what is less overwhelming for new people. |
Sure, overthinking and extreme precipitation are bad, but there is no issue in thinking a little ahead to better structure your code to prevent a big refactoring later on. About readability:
Seems really easy to beginners understand what this method will do. If you are not familiar with Spring: Yes, that is the whole thing, a simple interface with the method name "emulating" a SQL, Spring will do the rest. Also, if you want, you can also write your own SQL. |
I can see your point, sure sure. If the setup is as straightforward as that code snippet then I guess Spring might be okay 🤷♂️ |
As already asked and suggested in #4 there is a need to define what Databse and DB-Accessor will be used.
My suggestion would be To use SQLite and JOOQ.
SQLite needs almost no setup and thus makes the bot more accessible for newer people.
On top of that JOOQ makes the Database exchangable and abstracts raw SQL.
Yet JOOQ code is still pretty close to plain SQL which makes it again good for beginners learning SQL.
We definetly need some more feedback on frameworks and libraries. Maybe someone else knows a better combo.
The text was updated successfully, but these errors were encountered: