hexaredecimal / BlazingWebX

A java library for creating webservers and building web user interfaces 100% in java.
https://blazingwebx.onrender.com/
19 stars 0 forks source link

ORM #1

Closed hexaredecimal closed 2 weeks ago

hexaredecimal commented 2 months ago

Add an ORM API that follows the builder pattern and how the project works.

hexaredecimal commented 2 months ago

The ORM should be built on top of the JDBC package and follow the general webx design of using the builder pattern in constructing sql statements instead of strings.

class Person {
   private String name, email; 
   ....
}

try (
  var con = BlazingDB.create("sqlite", "users.db"); ) {
  List<Person> result = con
    .select(Query.All)
    .from(Query.List("users p ", "emails e"))
    .where(Query.Cond("=", "e.uid", "p.uid"))
    .execute()
    .map(Person.class); 

   .....
} catch (Exception e) { // Do better here
 ....
} 
hexaredecimal commented 2 weeks ago

Still have to figure out if this can be affected by sql injections.

hexaredecimal commented 2 weeks ago

ORM Implemented in this commit 992da1bb5a7526479505ec095eb7c9b219b5de50