spring - Grails 3.x: Re-using JPA/Hibernate Domain classes: Domain class not found -


i have spring 4.1.0 back-end application domain classes annotated in jpa (w/hibernate 4.3.5 persistence provider) using maven build tool. want add web front-end component app , have decided use grails 3.x web framework. want re-use existing jpa annotated domain classes grails , use generate-all create controllers , views each domain model. first milestone goal basic crud functionality on old domain models web app.

following information found in grails documentation , in older blog posts related posts, created new grails project , packaged existing project jar , installed (i ran mvn install -dskiptests exact) , added build.gradle (actually want have 1 project in end, thought i'd try way first because don't want wrestle having maven , gradle in same project yet):

 repositories {  ...  mavenlocal()  ... }  dependencies {  ...   compile "com.my-company:my-spring-app:1.0.0.ci-snapshot"  ... } 

no warnings or errors intellij idea 14 far. created grails-app/conf/hibernate/hibernate.cfg.xml file , tried putting 1 of old jpa annotated entities in now:

<?xml version='1.0' encoding='utf-8'?> <!doctype hibernate-configuration system         "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"> <hibernate-configuration>     <session-factory>         <mapping package="com.my-company.my-spring-app.domain" />         <mapping class="com.my-company.my-spring-app.domain.city" />     </session-factory> </hibernate-configuration> 

no complaints ide here either. city.java entity class looks like:

package com.my-company.my-spring-app.domain;  import javax.persistence.*; import java.util.date; import java.util.hashset; import java.util.set;  /**  * city generated hbm2java  */ @entity @table(name = "city",      schema = "public",      uniqueconstraints = @uniqueconstraint(columnnames = "name")) public class city implements java.io.serializable {  private static final long serialversionuid = 4674557242772722625l;  @id @sequencegenerator(name = "city_gen",                    schema = "public",                    sequencename = "city_id_seq") @generatedvalue(strategy = generationtype.sequence,                 generator = "city_gen") @column(name = "id",         unique = true,         nullable = false) private long id;  @manytoone(fetch = fetchtype.lazy) @joincolumn(name = "countryid",             nullable = false) // @joincolumn(name = "country_id", nullable = false) private country country;  @column(name = "name",         unique = true,         length = 200) private string name; ... } 

then jumped grails console , tried generate controller , views city domain class:

grails generate-all com.my-company.my-spring-app.domain.city 

but domain class not found error:

| error domain class not found name com.my-company.my-spring-app.domain.city 

i created grails 2.5.0 app, put my-spring-app.jar in lib/ , tried again see if issue 'bleeding edge' grails 3.0.1 got same result.

does know what's going on here? how can re-use old jpa domain classes grails 3.x can stay dry 1 set of domain entities?

i resolved similar issue putting hibernate.cfg.xml in grails-app/conf (not inside hibernate subdirectory) described in mapping-with-hibernate-annotations-in-grails-3-0-1.