jQuery in Action, 3rd edition
The moose likes Clojure and the fly likes Clojure with Spring/Hibernate? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Languages » Clojure
Bookmark "Clojure with Spring/Hibernate?" Watch "Clojure with Spring/Hibernate?" New topic

Clojure with Spring/Hibernate?

Eric Borm

Joined: May 17, 2011
Posts: 1
I'm coming from a Java background, but I've played with Scala a bit. In general, I liked what I saw. But, the Spring set of functionality is also important to me, and I was disappointed in the availability of Scala to Spring integration.

From what I saw, Scala doesn't provide a particularly clean integration with Spring/Hibernate. In some ways, the community has tried to provide replacements (Lift, for example) rather than integrate with the existing libraries. I was wondering in what ways the story with Clojure is similar or different. Is Spring integration, for example, a relatively clean process? Or, does the community provide some equivalent functionality? Same question goes for Hibernate.

Also, if there are some equivalent libraries, how mature are the solutions?

Hussein Baghdadi
clojure forum advocate

Joined: Nov 08, 2003
Posts: 3479

I'm not an expert but I don't think there is something called Scala-Spring integration of Clojure-Spring integration.
Both Scala and Clojure provide JVM integration and that is what really matter.
Code your Spring application in Scala or Clojure, you will got JVM bytecode at the end of the day.
Sean Corfield
Ranch Hand

Joined: Feb 09, 2011
Posts: 283

Well, Spring and Hibernate are very object-centric so, whilst you can write Java-compatible objects in Clojure, it's more idiomatic to work at a functional level on more general data structures.

Clojure's SQL library (formerly clojure.contrib.sql, now clojure.java.jdbc) allows for maps to be read from / inserted into database tables very cleanly - and there are some Clojure libraries that offer additional abstractions - so Hibernate isn't really an idiomatic fit for Clojure.

What aspects of Spring are important to you? Dependency injection doesn't really make sense for Clojure. AOP is easy (but handled slightly differently). If you're thinking about MVC and web apps, that's definitely an area where Clojure is fairly weak at the moment, in my opinion (and why I use Clojure for the Model of my apps, but not the View-Controller portions, right now).
I agree. Here's the link: http://aspose.com/file-tools
subject: Clojure with Spring/Hibernate?
jQuery in Action, 3rd edition