2
votes

Does GORM 6.1.8.RELEASE for Hibernate require any changes to domain classes?

Is joinTable in the domain mapping a recent addition to GORM?

I copied my domain classes from a working Grails 2.5.1 project to a Grails 3.2 project. When I launch the skeleton app with "dbCreate: 'validate'" I get the following error:

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'methodValidationPostProcessor' defined in class path resource [org/springframework/boot/autoconfigure/validation/ValidationAutoConfiguration.class]: Unsatisfied dependency expressed through method 'methodValidationPostProcessor' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateDatastoreServiceRegistry': Cannot resolve reference to bean 'hibernateDatastore' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateDatastore': Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.grails.orm.hibernate.HibernateDatastore]: Constructor threw exception; nested exception is org.hibernate.MappingException: Foreign key (FK56o1sv2813gshwyyok919a6gp:library_document_attachments [])) must have same number of columns as the referenced primary key (library_document [id])

I don't have a composite key or any custom mapping in the association.

class LibraryDocument extends Trackable {

// Attributes
...

// Relationships
Attachment latestVersion
static belongsTo = [...]

SortedSet attachments
static hasMany = [attachments: Attachment]
...
}

Project Version information:

grailsVersion=3.3.2
gormVersion=6.1.8.RELEASE
gradleWrapperVersion=3.5
1
@JeffScottBrown Is there any documentation on upgrading from Grails 2.5 to Grails 3.2? I would be epically interested in what to look for when migrating domain classes.user1452701
You can refer this stackoverflow.com/questions/53514129/… and see if it helps.Hasan K

1 Answers

1
votes

Does GORM 6.1.8.RELEASE for Hibernate require any changes to domain classes?

The answer to that will depend on a number of factors in your application. There are lots of domain classes for which no changes will be required.

Is joinTable in the domain mapping a recent addition to GORM?

No. We added that about 10 years ago and it was included in 1.0. https://github.com/grails/grails-core/commit/de590be6452715a119931d26bcc50c6a72e96170