ORM library to connect Database to a data class

I have a SQL database and I want to connect it to my Java file by JDBC . But ,I don't want to write seperate statement for fetch ,insert query operations. Any library that can help me. Ex: I have a Class Product with 20 column fields class Product { String name; Int Id; public Product (a,b) { this.name=a; this.Id=b;} } Rather than getString() from resultset query for each column and calling it's constructor manually. I wanted to know if I can have similar structure to : ArrayList<Product> res=db.execute();
6 Replies
JavaBot
JavaBot•7mo ago
⌛ This post has been reserved for your question.
Hey @CJ__47! Please use /close or the Close Post button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically marked as dormant after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
JavaBot
JavaBot•7mo ago
Please format your code to make it more readable. For java, it should look like this:
​`​`​`​java
public void foo() {

}
​`​`​`​
​`​`​`​java
public void foo() {

}
​`​`​`​
dan1st
dan1st•7mo ago
There are multiple ORM libraries in Java. The most well-known is probably Jakarta Persistence.
CJ__47
CJ__47OP•7mo ago
Any orm I can use without relying on spring/beans, as my code is pure java class
dan1st
dan1st•7mo ago
JPA can be used without Spring but there are also others like MyBatis I think nvm QueryDSL seems to do that pretty much well, MyBatis kinda does a bit in that direction as well
JavaBot
JavaBot•7mo ago
💤 Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived. If your question was not answered yet, feel free to re-open this post or create a new one. In case your post is not getting any attention, you can try to use /help ping. Warning: abusing this will result in moderative actions taken against you.

Did you find this page helpful?