Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Clojure with Spring/Hibernate?

 
Eric Borm
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?

Thanks...Eric
 
Hussein Baghdadi
clojure forum advocate
Bartender
Posts: 3479
Clojure Mac Objective C
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 305
11
Clojure Linux Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic