grails-data-mapping icon indicating copy to clipboard operation
grails-data-mapping copied to clipboard

GORM doesn't respect table schema mapping on table-per-subclass inherited domain classes

Open U47 opened this issue 9 years ago • 7 comments

Grails 3.1.1, against an Oracle database

When mapping a table-per-subclass strategy with a schema specified, the schema is picked up by the superclass, but not by the subclass. See below.

class A

mapping= {
  table(schema: 'WOOT', name 'A')
  tablePerHierarchy(false)
}

class B extends A

mapping= {
  table(schema: 'WOOT', name: 'B')
} 

B.read(1) results in: Hibernate: select ... from B this_ inner join WOOT.A this_1_ Class B does not have the schema prepended in the SQL statement.

U47 avatar Feb 17 '16 22:02 U47

Doing a bit of digging among Hibernate haunts hasn't turned up anything particular to this, either.

U47 avatar Feb 17 '16 22:02 U47

Gah. Just realized there's a grails-data-mapping project. Any way to move this issue there?

U47 avatar Feb 17 '16 23:02 U47

Just closing this one and creating one in grails-data-mapping

graemerocher avatar Feb 18 '16 07:02 graemerocher

I can't find the issue in grails-data-mapping so adding a comment here instead...

I can confirm that I am experiencing exactly the same issue in Grails 2.5.0 - i.e. the superclass picks up the schema but subclass schema definition is ignored.

Cookalino avatar Dec 19 '16 09:12 Cookalino

Also, column names mapped in super class override column names mapped in subclasses. Selects use the name defined in super class.

bruno-lopes avatar Jun 19 '19 12:06 bruno-lopes

Was this ever fixed? I am running grails 3.0.17 having the same issue.

davidmhfreire avatar Aug 04 '20 16:08 davidmhfreire

same issue, some solutions?

rodolfosaraiva avatar Apr 09 '21 18:04 rodolfosaraiva