{"repo":"cadenzauk/siesta","free":true,"listed":false,"github":"https://github.com/cadenzauk/siesta","clone":"git clone https://github.com/cadenzauk/siesta.git","description":"Typesafe API for SQL","language":"Java","stars":29,"topics":["java","orm","sql","database"],"license":"MIT","category":"databases-storage","readme_excerpt":"SIESTA S IESTA I s an E asy S QL T ypesafe A PI that lets you write SQL queries in Java. It is Easy because the interface is discoverable with autocompletion guiding you as you program. It is Typesafe because queries are written in strongly-typed Java code instead of just being embedded in strings. Examples Let's look at a few examples to see how it works. Inserting into the Database First we'll create a table for using Liquibase. And then we'll need our Java object we want to store in that table: Now we can create an object and insert it as simply as Database is the heart of SIESTA. It holds information about how to map our objects to the database, what dialect of SQL we're using etc. SqlExecutor is an interface that SIESTA uses to actually execute the SQL or DML. Here we're using an implementation based on Spring's JdbcTemplate . The example works because the default NamingStrategy converts Java field names to database column names and Java classes to tables by splitting camel case words with underscores and converting to uppercase, so widgetId becomes WIDGET ID as in our table. You can implement a different naming strategy if you like, or you can use JPA annotations to explicitly name the columns and Tables. Queries Querying the database is done via a fluent API. You can also do joins and projections: One slight difference you'll have noticed from SQL syntax is that we do projection via select after the from and join clauses. Apart from that, the syntax follows SQL pretty ","default_branch":null,"files":null,"tree":[],"storefront":"/r/cadenzauk","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/cadenzauk/siesta/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}