r/developers • u/MinzoidSH • 15h ago
Programming Built a lightweight JDBC library because I was tired of hand-writing the same boilerplate — would love feedback
Hey everyone,
I'm a CS student working on a few side projects, and in one of them I needed to talk to a database from plain Java (no Spring). I ended up hand-writing the same connection setup, PreparedStatement binding, and ResultSet-to-object mapping over and over, and most existing solutions either assume you're in Spring Boot or go full ORM with a lot of complexity I didn't need.
So I built Sabre — a small, framework-agnostic library that handles the common CRUD stuff for you (save/find/update/delete via simple annotations), but still lets you drop to raw SQL whenever you need something more complex, like joins or aggregates.
Example of what it looks like in use:
Sabre db = Sabre.connect("jdbc:mysql://localhost/mydb", "user", "pass");
@Table("users")
class User {
@Id int id;
String name;
int age;
}
db.save(user);
User found = db.findById(User.class, 1);
List<User> adults = db.query(User.class).where("age", ">", 18).orderBy("name").list();
It's built on plain JDBC + HikariCP for pooling, works with any JDBC driver (MySQL, Postgres, SQLite tested so far), and is on JitPack if anyone wants to try it.
Repo: github.com/Minzoid/Sabre
This is still early (v1.0), so I'd genuinely appreciate feedback — API design critiques, edge cases I haven't thought of, or just "this already exists and does it better" pointers. Thanks for reading!