apache / apache/grails-core

Subclass schema mapping with tablePerHierarchy false

Open
#14,427 1 comment 0 reactions 0 assignees View on GitHub
relates-to: grails-data-hibernate5
Dominant language
Groovy
Stars
2.9k
Forks
975
Avg merge
1d 22h
Merged PRs (30d)
92

Description

When using tablePerHierarchy false, i lost subclass schema mapping and consequently, get this error:

`Caused by: org.postgresql.util.PSQLException: ERROR: relation "school_year_regular" does not exist`

```
class SchoolYear {
...
static mapping = {
table schema: 'agis'
discriminator column: "type"
tablePerHierarchy false
}
}
```

```
class SchoolYearRegular extends SchoolYear {
...
static mapping = {
table schema: 'agis'
discriminator "Regular"
}
}
```

### Environment Information
grailsVersion=4.0.8
gormVersion=7.0.4
gradleWrapperVersion=5.6.4

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the SchoolYear and SchoolYearRegular mappings with tablePerHierarchy false on the stated Grails, GORM, Gradle, and PostgreSQL versions. Investigate how the subclass table schema is resolved; done means the subclass query uses the agis schema and no longer reports that school_year_regular does not exist.

Written by the indexing model from the issue text.

Assessment

Tech stack
groovy
Domain
backend, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.