Results 1 to 3 of 3

Thread: Showing TPCH discriminator on list view

  1. #1

    Default Showing TPCH discriminator on list view

    Hi all,

    I have a domain object with some subclasses. I'm using Table Per Class Hirarchy and have a customized discriminator column and values for the subclasses.

    Parent contains:
    Code:
    	static mapping = {
    		tablePerHierarchy true
    		discriminator column:"content_type", value: "basic asset"
    	}
    subclasses contain:
    Code:
    	static mapping = {
    		discriminator value: "slide"
    	}
    Which works fine and is what I want. However I have a "list" view for the base class which shows all object instances of the parent and any subclass. On this list view I'd like to show a column with the discriminator value I defined in each subclass. I tried several hacks to access it and failed miserably so far. I tried adding fields with the same column as the discriminator and such nasty things.

    Is there any way to access the discriminator on a domain object instance? Right now I'm using the class property instead, but that contains package information I don't want to have on the view.

    Cheers,
    Thomas

  2. #2
    Join Date
    Jun 2010
    Location
    London
    Posts
    304

    Default

    Some possible solutions on the Hibernate forum. There are no short cuts from Grails as far as I know.

  3. #3

    Default

    As I have the convention classname = discriminator name in my domain objects, I'm using now class.getSimpleName() to display the discriminator in JSON.

    Sorry, that I didn't update this thread. And thx for the hint.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •