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
⌛ This post has been reserved for your question.
Hey @CJ__47! Please useTIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here./closeor theClose Postbutton 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.
Please format your code to make it more readable. For java, it should look like this:
There are multiple ORM libraries in Java. The most well-known is probably Jakarta Persistence.
Any orm I can use without relying on spring/beans, as my code is pure java class
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
💤 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.