grails / grails-data-mapping

GORM - Groovy Object Mapping
http://gorm.grails.org/
218 stars 198 forks source link

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

Open U47 opened 8 years ago

U47 commented 8 years ago

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 commented 8 years ago

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

U47 commented 8 years ago

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

graemerocher commented 8 years ago

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

Cookalino commented 7 years ago

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.

bruno-lopes commented 5 years ago

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

davidmhfreire commented 4 years ago

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

rodolfosaraiva commented 3 years ago

same issue, some solutions?