Grails

tablePerHierarchy Bug when accessing collection of subclasses

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.0-RC3, 1.0-RC4
  • Fix Version/s: 1.0.2
  • Component/s: Persistence
  • Labels:
    None
  • Environment:
    Windows XP Pro, Grails 1.0RC4, Groovy 1.5.1

Description

From Mailing Group:

I have a "Superclass" called ConfigurationItem and a number of subclasses including one called Hardware. In addition, each Hardware has an associated HardwareType, so that each HardwareType has many Hardwares. I tried to change my inheritance strategy in ConfigurationItem to:

static mapping = {
tablePerHierarchy false
}

Now when I call:

hardwareType.hardwares

I get the following exception:

Column not found: HARDWARES0_.CLASS in statement [select hardwares0_.hardware_type_id as hardware2_1_, hardwares0_.id as id1_, hardwares0_.id as id14_0_, hardwares0_1_.version as version14_0_, hardwares0_1_.author as author14_0_, hardwares0_1_.description as descript4_14_0_, hardwares0_1_.name as name14_0_, hardwares0_1_.owner_email as owner6_14_0_, hardwares0_1_.owner_name as owner7_14_0_, hardwares0_1_.parent_id as parent8_14_0_, hardwares0_.hardware_type_id as hardware2_17_0_, hardwares0_.host_name as host3_17_0_, hardwares0_.internet_protocol_address as internet4_17_0_, hardwares0_.mac_address as mac5_17_0_, hardwares0_.purchase_date as purchase6_17_0_ from hardware hardwares0_ inner join configuration_item hardwares0_1_ on hardwares0_.id=hardwares0_1_.id where ( hardwares0_.class = 'Hardware') and hardwares0_.hardware_type_id=?]

It appears that it expects the "class" column that exists in the Hierarchy mapping.

I've attached the three domain objects.

  1. ConfigurationItem.groovy
    18/Jan/08 7:04 PM
    1 kB
    Steve Holmes
  2. Hardware.groovy
    18/Jan/08 7:04 PM
    0.5 kB
    Steve Holmes
  3. HardwareType.groovy
    18/Jan/08 7:04 PM
    0.4 kB
    Steve Holmes

Issue Links

Activity

Hide
Graeme Rocher added a comment -

Bulk closing bunch of resolved issues

Show
Graeme Rocher added a comment - Bulk closing bunch of resolved issues

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: