augustoccesar / querybuilder-mapper Goto Github PK
View Code? Open in Web Editor NEWA easier way to map query results to Java Objects
A easier way to map query results to Java Objects
When the project is using JPA, it already has a @Column
annotation on models, so, need to create a way to verify following the rules:
@Column
annotation, work as it is now.@Column
, get the data from it and build as the previous.@Column
, get the fields and consider it column name as the attribute name in snake case.Create a way to reduce the boilerplate code produced every time that is going to run a query
try (PreparedStatement stmt = this.connection.prepareStatement(sql)) {
try (ResultSet rs = stmt.executeQuery()) {
while (rs.next()) {
// Do stuff with each result
}
}
}
Looking for a way to do it simpler, like
SomeClass.executeQuery(sql, connection, (rs) -> {
// Do stuff with each result
});
If query contains ?
than, be able to pass the parameters
SomeClass.executeQuery(sql, connection, param1, param2, param3, (rs) -> {
// Do stuff with each result
});
// or
ArrayList<Object> params = new ArrayList<>();
SomeClass.executeQuery(connection, params, (rs) -> {
// Do stuff with each result
});
When the resultset contains a null date, the BeanUtils throw an exception.
As it is now, you can only create a new instance when mapping the result of a query
User user = new Mapper<User>("u").map(rs, User.class);
need to create a way to map to an existing instance
User user = new User();
new Mapper<User>("u").map(rs, user);
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.