Skip to content
/ SQLly Public

SQLly provides a simple way to map your JDBC ResultSet into Java objects

License

Notifications You must be signed in to change notification settings

klepto/SQLly

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SQLly

SQLly provides a simple way to map your JDBC ResultSet into Java objects. Define a class, pass ResultSet to SQLly and get Java objects in return. It's that simple.

 

Examples

Let's say we are fetching books from a database. First of all let's define a class that represents a single book.

public  class Book {

	@ColumnName("book_id")
	private int id;

	private String name;
	private String author;

	public int getId() {
		return id;
	}

	public String getName() {
		return name;
	}

	public String getAuthor() {
		return author;
	}

}

 

Execute our query and parse the results.

Statement statement = connection.prepareStatement("SELECT book_id, name, author FROM books");
ResultSet resultSet = statement.executeQuery();

Set<Book> books = Sqlly.parse(resultSet, Book.class);

 

For single row results we can simply call:

Optional<Book> optional = Sqlly.parseRow(resultSet, Book.class);

 

Copyright

SQLly is open-source software released under the GNU general public license, please see the LICENSE file for details.

About

SQLly provides a simple way to map your JDBC ResultSet into Java objects

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages