Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Blocker
-
Resolution: Fixed
-
Affects Version/s: 1.0.1
-
Fix Version/s: 1.0.2
-
Component/s: Persistence
-
Labels:None
-
Environment:Grails 1.0.1, Groovy Version: 1.5.4 JVM, 1.5.0_13-121, OS X 10.4.11
Description
I have a simple class hierarchy which uses a table-per-subclass.
However, the id column is, unfortunately, not named 'id', thus would use a custom column definition in the static mapping block. Unfortunately, this doesn't appear to work.
class StationEvent {
Long id
String station
static mapping = {
id column: 'STATION_EVENT_ID'
tablePerSubclass true // tablePerHierarchy false doesn't seem to work either
version false
}
}
class PlateEvent extends StationEvent {
String plate
static mapping = {
id column: "STATION_EVENT_ID"
tablePerSubclass true
version false
}
}
As you can see, the tables share the same PK column name.
However, the generated select statement uses 'id' as the column name for the sub class, when I would expect 'STATION_EVENT_ID':
select plateevent0_.id as STATION1_4_0_, plateevent0_1_.station as station4_0_, plateevent0_.plate as plate5_0_ from plate_event plateevent0_ inner join station_event plateevent0_1_ on plateevent0_.id=plateevent0_1_.STATION_EVENT_ID where plateevent0_.id=?
Should have marked this one a blocker.