views:

15

answers:

1

I am coming from the ruby world and want to be able to use Java to interactively create objects and query the database like with IRB. Which Java database APIs work with beanshell?

+1  A: 

I've never used beanshell, so maybe this is way off target, but what you're asking for seems very close to what Grails offers. It uses JPA under the covers for the data aspects. It also provides a console that can be used to interactively interact with the database.

John Engelman
+1 for grails suggestion. All the Java API are full of resource/transaction management or using annotations, so they are not really made for interactive use. groovy has closures, and you immediately see libraries which handle the resource/transaction things.
Peter Tillemans
Can I use the code snippets from Grails within a Java application?
Zubair
Grails is a framework built on Groovy which is based on Java. So the answer to your question is Yes. A Grails application cause integrate and use Java code and the Java code cause access the Grails code as well. I'm not sure if you have to be running from the Grails app of if you just have to compile the grails classes. If you're running outside the grails framework you probably won't get the database capabilities...Grails basically is handling all that for you, so if you don't run the framework, then you lose it.
John Engelman