java

2018-02-15T18:37:45.000412Z

@polymeris Maybe the JDBI? But i’m also curious, i bet @seancorfield would be a good person to ask.

2018-02-15T18:39:13.000298Z

http://jdbi.org/

2018-02-15T18:40:57.000704Z

I show hugSql to java devs and i feel like i get blank stares. Like either they dont get the problem or i dont. I’m writing the same jdbc boiler code all over the place. I’m sure there are lots of ppl in the java community that have ways to bring in standard defaults

2018-02-15T18:44:26.000572Z

But i haven’t dug into postgres and the jdbc to be anything close to an authority on what looks good in a demo vs what works well over time…

polymeris 2018-02-15T18:45:46.000449Z

Thanks! Jdbi takes a different approach than Yesql, but looks interesting. My colleagues mostly reach for full-fledged ORM solutions. Something like this could serve as gateway for a more SQL-centric approach

2018-02-15T19:02:07.000341Z

@polymeris I welcome any feedback on these ideas. I’m dealing a lot with sql and java at the minute so i’m very invested in these issues… Taking a step back. I think we (devs) have some fundamental constraints. * Our core language constructions cannot help us construct SQL queries as their strings. Pile that on top of a lot of other issues and you end up wanting something that looks like Datomic. * OOP languages (java at least) want you to model data with classes, classes to my knowledge can’t dynamically conform to their stimulus (adding or removing data). Of course, collections in java have this interface, so why not use them intead? Do enough of that introspection and you will find that the idea of a class isn’t that useful at all (polymorphism is a different abstraction) and you abandon classes it all together (and were we are in #clojure) ORMS fall down because most OOP languages don’t map well to the grammar of SQL. HugSQL ignores that issue by just using sql and returning the results in clojure data types. Something like HoneySql solves the problem of making the sql compossible within your language but i’m not sure what the costs of that might be or where it fails to work as expected. For instance, postgresSQL is different then mySql, i doubt korma handles those differences… I think mixing HoneySql and HugSql would be acceptable given they handle different issues and the core problem rests at a deeper level then the application developer can tackle. edit korma-> honey

2018-02-15T19:07:47.000553Z

Most of that is me trying to interoperate Rich Hickeys work.

donaldball 2018-02-15T19:19:48.000554Z

Honeysql does a pretty great job at that first one in my experience.

seancorfield 2018-02-15T19:33:04.000685Z

Know about Java libraries? Me? 🙂 I learned Java back in the 1.1 days and pretty much moved off to other languages around Java 5 so I don't pay attention to that ecosystem, except where I need something for Clojure that doesn't seem to have a Clojure version... sorry.

2018-02-15T20:26:00.000643Z

I think i said korma but meant honeysql

seancorfield 2018-02-15T21:23:07.000197Z

FWIW, I'm in the camp that stares blankly at HugSQL -- it doesn't feel like it solves a problem I have. Maybe I just don't see SQL strings in my code as a problem? When I have code that operates on the database, I like to see what the query is right there. I don't want to go find a SQL file that contains something that gets turned into a function that my code is calling. With HugSQL, you lose jump-to-definition in your IDE/editor.

seancorfield 2018-02-15T21:29:04.000532Z

@polymeris Perhaps this is a useful SO thread for answering your question? https://stackoverflow.com/questions/1544335/java-storing-sql-statements-in-an-external-file /cc @drewverlee

seancorfield 2018-02-15T21:30:00.000502Z

Axamol and iBATIS both look like ColdFusion markup to me 🙂

2018-02-15T21:39:55.000058Z

@seancorfield Well i get back syntax highlighting for my sql! how would i know its a reserved word other wise 🙂. Idk i felt hugsql was almost no cost for some nice syntactic sugar and boiler plate removal. But as i haven’t used it in anger, i’m really just hoping. I’m guessing you have less boiler plate then i’m currently dealing with.

seancorfield 2018-02-15T21:57:09.000649Z

I don't consider (jdbc/query db ["select some stuff here = ?" 42]) to be boilerplate... what boilerplate are you referring to? (and we should probably take this to #sql at this point)