You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@groovy.apache.org by Richard Heintze <si...@yahoo.com> on 2015/11/25 23:11:26 UTC

How to use JPA with spring boot/"spring run"

 A couple of years ago I wrote a little groovy demonstration of JPA that worked with MSSQL, MySQL, Oracle, H2, Derby and maybe a few others.
Now that I have been reading about the spring boot "spring run" command accepting a single groovy source code file I thought I was give it a try with JPA.
However, I my single source code file that demonstrates JPA no longer works with the groovy command in groovy 2.3 (and it does not work with the "spring run" command either).
The entity manager and friends are having trouble finding the entity classes.
I was hoping that for small microservices, a few short domain or entity classes bundled in with the main program would not hurt and you can run the whole shootin' match from the "spring run" command.
But I guess not!
I cannot get it to work any more.
Since it has been a couple of years, I don't remember what version of groovy my little demo used to work on.
I love how groovy grapes allows me to avoid all that messiness of pom.xml and gradle files and I don't to worry which sub-directory all that stuff goes in (like the persistence.xml, the views and other resources that maven and eclipse cannot always agree on). I thought "spring run" was going to make it very easy to write small microservices and maybe spring MVC sites with one source code file and maybe a few html files.
But I guess not! Is it really true that I am no longer allowed to bundle my JPA @Entity class definitions in with the main program? Why not?
ThanksSiegfried