gorm - Error using generics on grails domain class -


i'm trying create generic abstract hierarchy implementation, code following:

abstract class abstracthierarchy<t> {     t parent      static hasmany = [children: t]      static constraints = {         parent(nullable: true)     }      static mapping = {         tableperhierarchy false     } } 

im getting error:

abstracthierarchy.groovy: -1: class java.lang.object refers class java.lang.object , uses 1 parameters, referred class takes no parameters. 

so question is, doing wrong? supported grails? searching error found http://jira.grails.org/browse/grails-11065 i'm using grails 2.3.7 way.

on account of type erasure, expect everywhere using t in domain model, might using object. gorm's perspective model above equivalent to

abstract class abstracthierarchy {     object parent      static hasmany = [children: object]      static constraints = {         parent(nullable: true)     }      static mapping = {         tableperhierarchy false     } } 

which assume not intended. moral of story is: don't use generics express relationships between domain classes.


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -