Does exists a java library that can create sql statements? I'm not in search of something fancy, just something at "string manipulation" level: I just use jdbc (with Preparestatements and Resultsets) but I don't really like to pass huge strings containing SQL code...
What I need is a "simple" Select class (or something similar); in my mind all I really want is to be able to do
SQLStatement stat = Select("*").from("table").where("condition and condition").orderby("something");
ResultSet rs = Connection.getResultSet(stat.toString());
/* equals to "select * from table where condition and condition order by something" */
Maybe I'm blind, but I cannot find something like that...
Obviously, I want some methods/class able to write inserts and updates and the other stuff...
I excluded ORMs for two reasons:
- the db schema it's "old" and I cannot change it, and I'm not sure how can I adapt the ORM to follow our db
- AFAIK the ORMs needs to change the model (maybe adding a base class, maybe you need to implements an interface) and the model in my project is big, old and grumpy
- Onestly, I don't really like ORMs: Objects and Set theory just aren't made to be mapped (IMHO)
plenty!!!SELECT,INSERT,UPDATE,DELETEStatements can vary from DB Server you are using. So Its very difficult to use it without a dialect. In Java most common Utility is Hibernate which have all these functions and many more.