#Spring Boot gradle and Hibernate need help

1 messages · Page 1 of 1 (latest)

novel jackal
#

ok so im likely stupid but im at the end of my wits... im trying to learn gradle on a project and i need to implement hibernate core and the hibernate processor or the JPA modelgen so i can create querries that are dependant on the metamodel but for the love of me i cant find a single place for where to find the gradle dependency lines for the projects ive tried multiple combinations and nothing seems to work and when i finally got the metamopdels to show up then docker just went noooooope you dont have dependencies installed that are needed (eventhough solo it compiled ok)

so my question would be where do i consistently find the links and/or how do i make them myself?

any help is greatly appreciated

warped hingeBOT
#

<@&1004656351647117403> please have a look, thanks.

#

Here is an AI assisted attempt to answer your question 🤖. Maybe it helps! In any case, a human is on the way 👍. To continue talking to the AI, you can use </chatgpt:1108714622413963314>.

#
TJ-Bot
Ok so im likely stupid but im at the end of my wits... im trying to learn gradle on a project and i need to implement hibernate core and the hibernate processor or the JPA modelgen so i can create querries that are dependant on the metamodel but for the lo

You're not stupid, learning new technologies can be challenging. To implement Hibernate Core in your Spring Boot project using Gradle, you need to add the Hibernate dependencies in your build.gradle file. Here's a step-by-step guide to help you:

  1. Open your build.gradle file and add the following dependencies:
dependencies {
    implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
    implementation 'org.hibernate:hibernate-core'
    runtimeOnly 'com.h2database:h2'
}
  1. Make sure you have the necessary repositories added in your build.gradle file:
repositories {
    mavenCentral()
}
  1. Sync your Gradle project to download the new dependencies by clicking on "Sync Project with Gradle Files" or running gradlew clean build in the terminal.

  2. Now you can start using Hibernate Core in your project to interact with your database. Don't forget to configure your database connection details in the application.properties file.

If you encounter any issues or need further help with implementing Hibernate Core in your Spring Boot project using Gradle, feel free to ask for assistance here. Remember, it's okay to struggle while learning, we're here to help you through it!

novel jackal
#

ok so the closest i got for now were these lines
implementation "org.hibernate:hibernate-core:7.0.2.Final"
annotationProcessor 'org.hibernate.orm:hibernate-jpamodelgen:6.1.6.Final'

craggy sinew
#

tried mvncentral to get them ? they got the gradle aswell

twilit tendon
#

What exactly are you trying to achieve? And if you just start with Gradle, use it with Kotlin build.gradle.kts. Groovy is no longer the main language

novel jackal
# twilit tendon What exactly are you trying to achieve? And if you just start with Gradle, use i...

Well the project i was given used groovy in the setup so its kinda scary for me to go away from that im a junior so i wouldnt like to think i know better than the person who sent me the project😅 i want to add the hibernate core and hibernate processor (formerly jpa modelgen) to the project so i can do custom querries with filters through specification. Ive used it in my school projects recently but in school we only used maven for building so im kinda winging it rn with groovy since its my first project i got from my job application

novel jackal
#

Ill try that

twilit tendon
#

So is this a new project which was recently setup or is it old?
Not sure why you need an additional library for that. If you use spring boot data jpa theres already built in support for custom queries, filtering etc...

novel jackal
twilit tendon
#

Tbh. if I gave you this spring project and you use this custom solution no one knows/uses instead of the built in and well tested framework I wouldn't hire you. This would show me you don't know "basic" spring frameworks and how to use them properly.

novel jackal
#

Ok that seems fair 🙂 ill do the spring querries then

#

Thanks for the help 🙂

twilit tendon
#

This seems like an entry level project to see what you know by your potential employer? Then it would be more important to have well structured and readable code, write tests etc...

novel jackal
#

I know they are a small firm but they do some projects for the government and stuff. From what they told me in the interview i would be in my own group and we would be doing something like a studying app (obviously didnt give me all the details for that) but from what i understood i would be building this from the ground up and senior would be next door if im at a loss.
It is an entry level project thats true
I try my best to keep up good practices thats actually why i wanted to implement the modelgen since its nice and readable
And i try to test everything i can but i dont do automated tests yet since im way too inexperienced to do stuff like that but all my (for now 3) api projects have postman tests with them so someone can test it easy dont know if that can be taken as actual tests though

twilit tendon
#

I try my best to keep up good practices thats actually why i wanted to implement the modelgen since its nice and readable
All that is also possible with the spring modules. You Create POJOs of the entities, and then use them to query things from the Database. I don't think theres any other way which is more readable and easier to use https://spring.io/guides/gs/accessing-data-jpa

twilit tendon
#

But I love it when employers want to hire juniors, pay junior salaries and expect them to build a whole app. And the next day they are surprised when the system is compromised because someone found an exploit in the app. Usually your part in the development is to implement simple tickets in an existing project preferably, build up your knowledge and have a Mid/Senior review your code.
Anyway, good luck 🙂

novel jackal
#

Honestly thats what i thought too🤣 but i am so eager to get a job in this field to get more exp im kinda taking anything that comes my way😅

twilit tendon
#

I'm not saying its your fault and you can't do anything wrong in your current position, just a bit irresponsible from the employers side