HQL has a special property named class that gets translated to the discriminator column, see the HQL where-clause documentation. Currently WebDSL adds an underscore prefix to this property, as is done for all entity properties. The special class property is useful when a specific entity type is required, but not the sub-entity types. Therefor it is useful to remove the underscore prefix for the class property, which does not give any problems since class is already a forbidden property name in WebDSL.

The following example shows how only the Moderator instance can be selected by using the class property.

application test

entity User {
}
entity Moderator : User {
}
entity Administrator : Moderator {
}

var u := User{};
var m := Moderator{};
var a := Administrator{};

page root() {
  output(from User) // returns the User, Moderator and Administrator
  output(from Moderator) // returns the Moderator and Administrator
  output(from Administrator) // returns only the Administrator
  output(from Moderator as m where m.class='Moderator') // returns only the Moderator
}
Submitted by Christoffer Gersen on 4 April 2013 at 14:23

On 4 April 2013 at 14:31 Christoffer Gersen tagged 1.3.0

On 4 April 2013 at 14:32 Christoffer Gersen commented:

Implemented in revision 5670


On 4 April 2013 at 14:32 Christoffer Gersen closed this issue.

Log in to post comments