DISQUS

Java Rants: Generate JPA (or GORM) classes from your database for Java and Grails

  • Stephan Schmidt · 2 years ago
    Hi,

    I've read your article and currently I play with Grails and JPA. When I use both together the application hangs.

    http://stephan.reposita.org/archives/2007/10/15...

    Do you have any ideas? Did you successfully use JPA with Grails?

    Thanks
    -stephan
  • sam · 2 years ago
    Hi Stephen,

    The Grails support is tested with the Grail-1.0-RC1 nightly build, not the currently stable release, because there are a number of new features that I needed to leverage. I also just use the built-in Hibernate support rather than trying to call out to the EntityManager myself -- I'm still using GORM, just with my JPA based annotation classes rather than Groovy based GORM classes. The one thing I forgot to note here though is that you have to tell GORM about the annotations:

    import org.codehaus.groovy.grails.orm.hibernate.cfg.GrailsAnnotationConfiguration
    dataSource {
    configClass = GrailsAnnotationConfiguration.class

    Otherwise GORM won't see the domain classes. As for using real JPA APIs I haven't tested it. I will try it later and see what I find.

    Sam
  • Parker · 2 years ago
    I tried it with Oracle, got an "ORA-00942 Table or View does not exist". Any Ideas ?

    java -classpath .;ojdbc5.jar;dbmap-r12.jar com.moonspider.dbmap.Generator -url jdbc:oracle:thin:@192.168.1.220:1521:mydb -user myuser -password mypass -driver oracle.jdbc.driver.OracleDriver -d mydb
    Error: java.sql.SQLException: ORA-00942: Tabelle oder View nicht vorhanden

    Usage: com.moonspider.dbmap.GenerateConfig
    ...
  • sam · 2 years ago

    I tried it with Oracle, got an “ORA-00942 Table or View does not exist”. Any Ideas ?


    java -classpath .;ojdbc5.jar;dbmap-r12.jar com.moonspider.dbmap.Generator -url jdbc:oracle:thin:@192.168.1.220:1521:mydb -user myuser -password mypass -driver oracle.jdbc.driver.OracleDriver -d mydb

    Error: java.sql.SQLException: ORA-00942: Tabelle oder View nicht vorhanden


    Usage: com.moonspider.dbmap.GenerateConfig





    Hi Parker,

    I've added an issue to the tracker on the site: http://code.google.com/p/dbmapper/issues/detail... . Can you rerun the command line with -Ddebug=true and post the stacktrace to the issue that I've opened?

    Thanks,
    Sam
  • Stephan Schmidt · 2 years ago
    Hi Sam,

    thanks for the feedback, I'll try RC1 and see if it works. When you try JPA directly later, it would be nice to drop me a note with
    the result, perhaps on my blog / using mail.

    Thanks
    -stephan