GORM Inheritence Mapping

classic Classic list List threaded Threaded
15 messages Options
Reply | Threaded
Open this post in threaded view
|

GORM Inheritence Mapping

graemer
Hi all,

Just like to point out a recently committed feature which extends the
capability of inheritence mapping.

It is now possible to define a domain model like below:

class Car {
     Long id
     Long version
     String category
     String model
}
class AlphaRomeo extends Car {
}
class Fiat extends Car {
}
class Ferrari extends Car {
}

And then use polymorphic dynamic finders:

def cars = Car.findAll() // will return all alphas, fiats and ferraris
def luxuryCars = Car.findAllByCategory('luxury') // get all luxury cars

Its pretty neat :-)

Cheers
Graeme

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply | Threaded
Open this post in threaded view
|

RE: GORM Inheritence Mapping

Dierk König
cool! eh - sorry - groovy!

another unique feature... congratulation!

Mittie

> -----Original Message-----
> From: [hidden email] [mailto:[hidden email]]On Behalf
> Of Graeme Rocher
> Sent: Montag, 12. Juni 2006 18:48
> To: [hidden email]
> Subject: [grails-user] GORM Inheritence Mapping
>
>
> Hi all,
>
> Just like to point out a recently committed feature which extends the
> capability of inheritence mapping.
>
> It is now possible to define a domain model like below:
>
> class Car {
>      Long id
>      Long version
>      String category
>      String model
> }
> class AlphaRomeo extends Car {
> }
> class Fiat extends Car {
> }
> class Ferrari extends Car {
> }
>
> And then use polymorphic dynamic finders:
>
> def cars = Car.findAll() // will return all alphas, fiats and ferraris
> def luxuryCars = Car.findAllByCategory('luxury') // get all luxury cars
>
> Its pretty neat :-)
>
> Cheers
> Graeme
>
> ---------------------------------------------------------------------
> To unsubscribe from this list please visit:
>
>     http://xircles.codehaus.org/manage_email

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply | Threaded
Open this post in threaded view
|

Re: GORM Inheritence Mapping

graemer
On 6/12/06, Dierk Koenig <[hidden email]> wrote:
> cool! eh - sorry - groovy!
>
> another unique feature... congratulation!
Well not really unique, but cool yes :-)

Graeme

>
> Mittie
>
> > -----Original Message-----
> > From: [hidden email] [mailto:[hidden email]]On Behalf
> > Of Graeme Rocher
> > Sent: Montag, 12. Juni 2006 18:48
> > To: [hidden email]
> > Subject: [grails-user] GORM Inheritence Mapping
> >
> >
> > Hi all,
> >
> > Just like to point out a recently committed feature which extends the
> > capability of inheritence mapping.
> >
> > It is now possible to define a domain model like below:
> >
> > class Car {
> >      Long id
> >      Long version
> >      String category
> >      String model
> > }
> > class AlphaRomeo extends Car {
> > }
> > class Fiat extends Car {
> > }
> > class Ferrari extends Car {
> > }
> >
> > And then use polymorphic dynamic finders:
> >
> > def cars = Car.findAll() // will return all alphas, fiats and ferraris
> > def luxuryCars = Car.findAllByCategory('luxury') // get all luxury cars
> >
> > Its pretty neat :-)
> >
> > Cheers
> > Graeme
> >
> > ---------------------------------------------------------------------
> > To unsubscribe from this list please visit:
> >
> >     http://xircles.codehaus.org/manage_email
>
> ---------------------------------------------------------------------
> To unsubscribe from this list please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply | Threaded
Open this post in threaded view
|

Re: GORM Inheritence Mapping

Jonathan Carlson
In reply to this post by graemer
Good news!  I'm curious, how does hibernate know if it is an AlphaRomeo
or a Fiat?  Does it add a column containing the class name, or does it
create a new subtable for each subclass?

Does it work if Ferrari (for example) has an extra field that the
others don't have?  I'm guessing this would work if the subtable option
is used.

- Jonathan


>>> [hidden email] 2006-06-12 11:48:01 AM >>>
Hi all,

Just like to point out a recently committed feature which extends the
capability of inheritence mapping.

It is now possible to define a domain model like below:

class Car {
     Long id
     Long version
     String category
     String model
}
class AlphaRomeo extends Car {
}
class Fiat extends Car {
}
class Ferrari extends Car {
}

And then use polymorphic dynamic finders:

def cars = Car.findAll() // will return all alphas, fiats and ferraris
def luxuryCars = Car.findAllByCategory('luxury') // get all luxury
cars

Its pretty neat :-)

Cheers
Graeme

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email 


______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________

______________________________________________________________________
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

Katun Corporation -- www.katun.com
_____________________________________________________________________

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply | Threaded
Open this post in threaded view
|

Re: GORM Inheritence Mapping

graemer
On 6/13/06, Jonathan Carlson <[hidden email]> wrote:
> Good news!  I'm curious, how does hibernate know if it is an AlphaRomeo
> or a Fiat?  Does it add a column containing the class name, or does it
> create a new subtable for each subclass?
Yes it creates a class column with the class name in.

>
> Does it work if Ferrari (for example) has an extra field that the
> others don't have?  I'm guessing this would work if the subtable option
> is used.
Yes it does work

Graeme

>
> - Jonathan
>
>
> >>> [hidden email] 2006-06-12 11:48:01 AM >>>
> Hi all,
>
> Just like to point out a recently committed feature which extends the
> capability of inheritence mapping.
>
> It is now possible to define a domain model like below:
>
> class Car {
>      Long id
>      Long version
>      String category
>      String model
> }
> class AlphaRomeo extends Car {
> }
> class Fiat extends Car {
> }
> class Ferrari extends Car {
> }
>
> And then use polymorphic dynamic finders:
>
> def cars = Car.findAll() // will return all alphas, fiats and ferraris
> def luxuryCars = Car.findAllByCategory('luxury') // get all luxury
> cars
>
> Its pretty neat :-)
>
> Cheers
> Graeme
>
> ---------------------------------------------------------------------
> To unsubscribe from this list please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>
> ______________________________________________________________________
> This email has been scanned by the MessageLabs Email Security System.
> For more information please visit http://www.messagelabs.com/email
> ______________________________________________________________________
>
> ______________________________________________________________________
> This email and any files transmitted with it are confidential and
> intended solely for the use of the individual or entity to whom they
> are addressed. If you have received this email in error please notify
> the system manager.
>
> Katun Corporation -- www.katun.com
> _____________________________________________________________________
>
> ---------------------------------------------------------------------
> To unsubscribe from this list please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply | Threaded
Open this post in threaded view
|

Re: GORM Inheritence Mapping

Jonathan Carlson
In reply to this post by graemer
So, if the subclass has an extra column does it create a new subtable?
...Or does it add it to the main table and ignore it for the other
subclasses?


>>> [hidden email] 2006-06-13 9:27:53 AM >>>
On 6/13/06, Jonathan Carlson <[hidden email]> wrote:
> Good news!  I'm curious, how does hibernate know if it is an
AlphaRomeo
> or a Fiat?  Does it add a column containing the class name, or does
it
> create a new subtable for each subclass?
Yes it creates a class column with the class name in.

>
> Does it work if Ferrari (for example) has an extra field that the
> others don't have?  I'm guessing this would work if the subtable
option
> is used.
Yes it does work

Graeme

>
> - Jonathan
>
>
> >>> [hidden email] 2006-06-12 11:48:01 AM >>>
> Hi all,
>
> Just like to point out a recently committed feature which extends
the

> capability of inheritence mapping.
>
> It is now possible to define a domain model like below:
>
> class Car {
>      Long id
>      Long version
>      String category
>      String model
> }
> class AlphaRomeo extends Car {
> }
> class Fiat extends Car {
> }
> class Ferrari extends Car {
> }
>
> And then use polymorphic dynamic finders:
>
> def cars = Car.findAll() // will return all alphas, fiats and
ferraris
> def luxuryCars = Car.findAllByCategory('luxury') // get all luxury
> cars
>
> Its pretty neat :-)
>
> Cheers
> Graeme
>
___________

______________________________________________________________________
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

Katun Corporation -- www.katun.com
_____________________________________________________________________

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply | Threaded
Open this post in threaded view
|

Re: GORM Inheritence Mapping

graemer
On 6/13/06, Jonathan Carlson <[hidden email]> wrote:
> So, if the subclass has an extra column does it create a new subtable?
> ...Or does it add it to the main table and ignore it for the other
> subclasses?
I believe the latter, which is why one limitation is that you can't
have not null columns in sub-classes as they HAVE to be nullable for
the other classes in the relationship to continue functioning

Graeme

>
>
> >>> [hidden email] 2006-06-13 9:27:53 AM >>>
> On 6/13/06, Jonathan Carlson <[hidden email]> wrote:
> > Good news!  I'm curious, how does hibernate know if it is an
> AlphaRomeo
> > or a Fiat?  Does it add a column containing the class name, or does
> it
> > create a new subtable for each subclass?
> Yes it creates a class column with the class name in.
>
> >
> > Does it work if Ferrari (for example) has an extra field that the
> > others don't have?  I'm guessing this would work if the subtable
> option
> > is used.
> Yes it does work
>
> Graeme
>
> >
> > - Jonathan
> >
> >
> > >>> [hidden email] 2006-06-12 11:48:01 AM >>>
> > Hi all,
> >
> > Just like to point out a recently committed feature which extends
> the
> > capability of inheritence mapping.
> >
> > It is now possible to define a domain model like below:
> >
> > class Car {
> >      Long id
> >      Long version
> >      String category
> >      String model
> > }
> > class AlphaRomeo extends Car {
> > }
> > class Fiat extends Car {
> > }
> > class Ferrari extends Car {
> > }
> >
> > And then use polymorphic dynamic finders:
> >
> > def cars = Car.findAll() // will return all alphas, fiats and
> ferraris
> > def luxuryCars = Car.findAllByCategory('luxury') // get all luxury
> > cars
> >
> > Its pretty neat :-)
> >
> > Cheers
> > Graeme
> >
> ___________
>
> ______________________________________________________________________
> This email and any files transmitted with it are confidential and
> intended solely for the use of the individual or entity to whom they
> are addressed. If you have received this email in error please notify
> the system manager.
>
> Katun Corporation -- www.katun.com
> _____________________________________________________________________
>
> ---------------------------------------------------------------------
> To unsubscribe from this list please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply | Threaded
Open this post in threaded view
|

Re: GORM Inheritence Mapping

Jonathan Carlson
In reply to this post by graemer
Thanks.  That'll work fine for simple stuff.  It's good to know not to
use it for more complex stuff with lots of subclass columns.  I can help
document this on the Wiki if you have a section there that mentions this
feature.

- Jonathan

>>> [hidden email] 2006-06-13 9:32:50 AM >>>
On 6/13/06, Jonathan Carlson <[hidden email]> wrote:
> So, if the subclass has an extra column does it create a new
subtable?
> ...Or does it add it to the main table and ignore it for the other
> subclasses?
I believe the latter, which is why one limitation is that you can't
have not null columns in sub-classes as they HAVE to be nullable for
the other classes in the relationship to continue functioning

Graeme

>
>
> >>> [hidden email] 2006-06-13 9:27:53 AM >>>
> On 6/13/06, Jonathan Carlson <[hidden email]> wrote:
> > Good news!  I'm curious, how does hibernate know if it is an
> AlphaRomeo
> > or a Fiat?  Does it add a column containing the class name, or
does

> it
> > create a new subtable for each subclass?
> Yes it creates a class column with the class name in.
>
> >
> > Does it work if Ferrari (for example) has an extra field that the
> > others don't have?  I'm guessing this would work if the subtable
> option
> > is used.
> Yes it does work
>
> Graeme
>
> >
> > - Jonathan
> >
> >
> > >>> [hidden email] 2006-06-12 11:48:01 AM >>>
> > Hi all,
> >
> > Just like to point out a recently committed feature which extends
> the
> > capability of inheritence mapping.
> >
> > It is now possible to define a domain model like below:
> >
> > class Car {
> >      Long id
> >      Long version
> >      String category
> >      String model
> > }
> > class AlphaRomeo extends Car {
> > }
> > class Fiat extends Car {
> > }
> > class Ferrari extends Car {
> > }
> >
> > And then use polymorphic dynamic finders:
> >
> > def cars = Car.findAll() // will return all alphas, fiats and
> ferraris
> > def luxuryCars = Car.findAllByCategory('luxury') // get all luxury
> > cars
> >
> > Its pretty neat :-)
> >
> > Cheers
> > Graeme
> >
> ___________
>
>
______________________________________________________________________
> This email and any files transmitted with it are confidential and
> intended solely for the use of the individual or entity to whom they
> are addressed. If you have received this email in error please
notify
> the system manager.
>
> Katun Corporation -- www.katun.com
>
_____________________________________________________________________
>
>
---------------------------------------------------------------------
> To unsubscribe from this list please visit:
>
>     http://xircles.codehaus.org/manage_email 
>
>

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email 


______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________

______________________________________________________________________
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

Katun Corporation -- www.katun.com
_____________________________________________________________________

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply | Threaded
Open this post in threaded view
|

Re: GORM Inheritence Mapping

graemer
There is already a bit about it on the GORM page: http://grails.org/GORM

feel free to elaborate :-)

Graeme

On 6/13/06, Jonathan Carlson <[hidden email]> wrote:

> Thanks.  That'll work fine for simple stuff.  It's good to know not to
> use it for more complex stuff with lots of subclass columns.  I can help
> document this on the Wiki if you have a section there that mentions this
> feature.
>
> - Jonathan
>
> >>> [hidden email] 2006-06-13 9:32:50 AM >>>
> On 6/13/06, Jonathan Carlson <[hidden email]> wrote:
> > So, if the subclass has an extra column does it create a new
> subtable?
> > ...Or does it add it to the main table and ignore it for the other
> > subclasses?
> I believe the latter, which is why one limitation is that you can't
> have not null columns in sub-classes as they HAVE to be nullable for
> the other classes in the relationship to continue functioning
>
> Graeme
>
> >
> >
> > >>> [hidden email] 2006-06-13 9:27:53 AM >>>
> > On 6/13/06, Jonathan Carlson <[hidden email]> wrote:
> > > Good news!  I'm curious, how does hibernate know if it is an
> > AlphaRomeo
> > > or a Fiat?  Does it add a column containing the class name, or
> does
> > it
> > > create a new subtable for each subclass?
> > Yes it creates a class column with the class name in.
> >
> > >
> > > Does it work if Ferrari (for example) has an extra field that the
> > > others don't have?  I'm guessing this would work if the subtable
> > option
> > > is used.
> > Yes it does work
> >
> > Graeme
> >
> > >
> > > - Jonathan
> > >
> > >
> > > >>> [hidden email] 2006-06-12 11:48:01 AM >>>
> > > Hi all,
> > >
> > > Just like to point out a recently committed feature which extends
> > the
> > > capability of inheritence mapping.
> > >
> > > It is now possible to define a domain model like below:
> > >
> > > class Car {
> > >      Long id
> > >      Long version
> > >      String category
> > >      String model
> > > }
> > > class AlphaRomeo extends Car {
> > > }
> > > class Fiat extends Car {
> > > }
> > > class Ferrari extends Car {
> > > }
> > >
> > > And then use polymorphic dynamic finders:
> > >
> > > def cars = Car.findAll() // will return all alphas, fiats and
> > ferraris
> > > def luxuryCars = Car.findAllByCategory('luxury') // get all luxury
> > > cars
> > >
> > > Its pretty neat :-)
> > >
> > > Cheers
> > > Graeme
> > >
> > ___________
> >
> >
> ______________________________________________________________________
> > This email and any files transmitted with it are confidential and
> > intended solely for the use of the individual or entity to whom they
> > are addressed. If you have received this email in error please
> notify
> > the system manager.
> >
> > Katun Corporation -- www.katun.com
> >
> _____________________________________________________________________
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe from this list please visit:
> >
> >     http://xircles.codehaus.org/manage_email
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe from this list please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>
> ______________________________________________________________________
> This email has been scanned by the MessageLabs Email Security System.
> For more information please visit http://www.messagelabs.com/email
> ______________________________________________________________________
>
> ______________________________________________________________________
> This email and any files transmitted with it are confidential and
> intended solely for the use of the individual or entity to whom they
> are addressed. If you have received this email in error please notify
> the system manager.
>
> Katun Corporation -- www.katun.com
> _____________________________________________________________________
>
> ---------------------------------------------------------------------
> To unsubscribe from this list please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply | Threaded
Open this post in threaded view
|

Re: GORM Inheritence Mapping

Jonathan Carlson
In reply to this post by graemer
Thanks Graeme,

I added this to the GORM page: (feel free to go in and change it if you
wish)

Technical note for those interested:  Under the covers, only one table
is used.  A class column specifies the subclass and any fields in the
subclasses are included on the same table.  Subclass fields cannot be
required because the underlying columns need to be nullable for the
other subclasses.

- Jonathan

>>> [hidden email] 2006-06-13 10:00:11 AM >>>
There is already a bit about it on the GORM page:
http://grails.org/GORM 

feel free to elaborate :-)

Graeme

On 6/13/06, Jonathan Carlson <[hidden email]> wrote:
> Thanks.  That'll work fine for simple stuff.  It's good to know not
to
> use it for more complex stuff with lots of subclass columns.  I can
help
> document this on the Wiki if you have a section there that mentions
this

> feature.
>
> - Jonathan
>
> >>> [hidden email] 2006-06-13 9:32:50 AM >>>
> On 6/13/06, Jonathan Carlson <[hidden email]> wrote:
> > So, if the subclass has an extra column does it create a new
> subtable?
> > ...Or does it add it to the main table and ignore it for the other
> > subclasses?
> I believe the latter, which is why one limitation is that you can't
> have not null columns in sub-classes as they HAVE to be nullable for
> the other classes in the relationship to continue functioning
>
> Graeme
>
> >
> >
> > >>> [hidden email] 2006-06-13 9:27:53 AM >>>
> > On 6/13/06, Jonathan Carlson <[hidden email]> wrote:
> > > Good news!  I'm curious, how does hibernate know if it is an
> > AlphaRomeo
> > > or a Fiat?  Does it add a column containing the class name, or
> does
> > it
> > > create a new subtable for each subclass?
> > Yes it creates a class column with the class name in.
> >
> > >
> > > Does it work if Ferrari (for example) has an extra field that
the

> > > others don't have?  I'm guessing this would work if the subtable
> > option
> > > is used.
> > Yes it does work
> >
> > Graeme
> >
> > >
> > > - Jonathan
> > >
> > >
> > > >>> [hidden email] 2006-06-12 11:48:01 AM >>>
> > > Hi all,
> > >
> > > Just like to point out a recently committed feature which
extends

> > the
> > > capability of inheritence mapping.
> > >
> > > It is now possible to define a domain model like below:
> > >
> > > class Car {
> > >      Long id
> > >      Long version
> > >      String category
> > >      String model
> > > }
> > > class AlphaRomeo extends Car {
> > > }
> > > class Fiat extends Car {
> > > }
> > > class Ferrari extends Car {
> > > }
> > >
> > > And then use polymorphic dynamic finders:
> > >
> > > def cars = Car.findAll() // will return all alphas, fiats and
> > ferraris
> > > def luxuryCars = Car.findAllByCategory('luxury') // get all
luxury

> > > cars
> > >
> > > Its pretty neat :-)
> > >
> > > Cheers
> > > Graeme
> > >
> > ___________
> >
> >
>
______________________________________________________________________
> > This email and any files transmitted with it are confidential and
> > intended solely for the use of the individual or entity to whom
they
> > are addressed. If you have received this email in error please
> notify
> > the system manager.
> >
> > Katun Corporation -- www.katun.com
> >
>
_____________________________________________________________________
> >
> >
>
---------------------------------------------------------------------
> > To unsubscribe from this list please visit:
> >
> >     http://xircles.codehaus.org/manage_email 
> >
> >
>
>
---------------------------------------------------------------------
> To unsubscribe from this list please visit:
>
>     http://xircles.codehaus.org/manage_email 
>
>
>
______________________________________________________________________
> This email has been scanned by the MessageLabs Email Security
System.
> For more information please visit http://www.messagelabs.com/email 
>
______________________________________________________________________
>
>
______________________________________________________________________
> This email and any files transmitted with it are confidential and
> intended solely for the use of the individual or entity to whom they
> are addressed. If you have received this email in error please
notify
> the system manager.
>
> Katun Corporation -- www.katun.com
>
_____________________________________________________________________
>
>
---------------------------------------------------------------------
> To unsubscribe from this list please visit:
>
>     http://xircles.codehaus.org/manage_email 
>
>

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email 


______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________

______________________________________________________________________
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

Katun Corporation -- www.katun.com
_____________________________________________________________________

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply | Threaded
Open this post in threaded view
|

Re: GORM Inheritence Mapping

Jonathan Carlson
In reply to this post by graemer
Hmmm, The wiki acts like it accepts my changes but then it doesn't
display them back to me.  Is it possible it has to be reviewed first?
Maybe someone else will have better luck pasting the below text at the
end of the Mapping Inheritance section

- Jonathan

>>> [hidden email] 2006-06-13 11:26:21 AM >>>
Thanks Graeme,

I added this to the GORM page: (feel free to go in and change it if
you
wish)

Technical note for those interested:  Under the covers, only one table
is used.  A class column specifies the subclass and any fields in the
subclasses are included on the same table.  Subclass fields cannot be
required because the underlying columns need to be nullable for the
other subclasses.

- Jonathan

>>> [hidden email] 2006-06-13 10:00:11 AM >>>
There is already a bit about it on the GORM page:
http://grails.org/GORM 

feel free to elaborate :-)

Graeme

On 6/13/06, Jonathan Carlson <[hidden email]> wrote:
> Thanks.  That'll work fine for simple stuff.  It's good to know not
to
> use it for more complex stuff with lots of subclass columns.  I can
help
> document this on the Wiki if you have a section there that mentions
this

> feature.
>
> - Jonathan
>
> >>> [hidden email] 2006-06-13 9:32:50 AM >>>
> On 6/13/06, Jonathan Carlson <[hidden email]> wrote:
> > So, if the subclass has an extra column does it create a new
> subtable?
> > ...Or does it add it to the main table and ignore it for the other
> > subclasses?
> I believe the latter, which is why one limitation is that you can't
> have not null columns in sub-classes as they HAVE to be nullable for
> the other classes in the relationship to continue functioning
>
> Graeme
>
> >
> >
> > >>> [hidden email] 2006-06-13 9:27:53 AM >>>
> > On 6/13/06, Jonathan Carlson <[hidden email]> wrote:
> > > Good news!  I'm curious, how does hibernate know if it is an
> > AlphaRomeo
> > > or a Fiat?  Does it add a column containing the class name, or
> does
> > it
> > > create a new subtable for each subclass?
> > Yes it creates a class column with the class name in.
> >
> > >
> > > Does it work if Ferrari (for example) has an extra field that
the

> > > others don't have?  I'm guessing this would work if the subtable
> > option
> > > is used.
> > Yes it does work
> >
> > Graeme
> >
> > >
> > > - Jonathan
> > >
> > >
> > > >>> [hidden email] 2006-06-12 11:48:01 AM >>>
> > > Hi all,
> > >
> > > Just like to point out a recently committed feature which
extends

> > the
> > > capability of inheritence mapping.
> > >
> > > It is now possible to define a domain model like below:
> > >
> > > class Car {
> > >      Long id
> > >      Long version
> > >      String category
> > >      String model
> > > }
> > > class AlphaRomeo extends Car {
> > > }
> > > class Fiat extends Car {
> > > }
> > > class Ferrari extends Car {
> > > }
> > >
> > > And then use polymorphic dynamic finders:
> > >
> > > def cars = Car.findAll() // will return all alphas, fiats and
> > ferraris
> > > def luxuryCars = Car.findAllByCategory('luxury') // get all
luxury

> > > cars
> > >
> > > Its pretty neat :-)
> > >
> > > Cheers
> > > Graeme
> > >
> > ___________
> >
> >
>
______________________________________________________________________
> > This email and any files transmitted with it are confidential and
> > intended solely for the use of the individual or entity to whom
they
> > are addressed. If you have received this email in error please
> notify
> > the system manager.
> >
> > Katun Corporation -- www.katun.com
> >
>
_____________________________________________________________________
> >
> >
>
---------------------------------------------------------------------
> > To unsubscribe from this list please visit:
> >
> >     http://xircles.codehaus.org/manage_email 
> >
> >
>
>
---------------------------------------------------------------------
> To unsubscribe from this list please visit:
>
>     http://xircles.codehaus.org/manage_email 
>
>
>
______________________________________________________________________
> This email has been scanned by the MessageLabs Email Security
System.
> For more information please visit http://www.messagelabs.com/email 
>
______________________________________________________________________
>
>
______________________________________________________________________
> This email and any files transmitted with it are confidential and
> intended solely for the use of the individual or entity to whom they
> are addressed. If you have received this email in error please
notify
> the system manager.
>
> Katun Corporation -- www.katun.com
>
_____________________________________________________________________
>
>
---------------------------------------------------------------------
> To unsubscribe from this list please visit:
>
>     http://xircles.codehaus.org/manage_email 
>
>

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email 


______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________

______________________________________________________________________
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

Katun Corporation -- www.katun.com
_____________________________________________________________________

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email


______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________

______________________________________________________________________
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

Katun Corporation -- www.katun.com
_____________________________________________________________________

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply | Threaded
Open this post in threaded view
|

Re: GORM Inheritence Mapping

Alan Kang
I've done it.

On 6/14/06, Jonathan Carlson <[hidden email]> wrote:

> Hmmm, The wiki acts like it accepts my changes but then it doesn't
> display them back to me.  Is it possible it has to be reviewed first?
> Maybe someone else will have better luck pasting the below text at the
> end of the Mapping Inheritance section
>
> - Jonathan
>
> >>> [hidden email] 2006-06-13 11:26:21 AM >>>
> Thanks Graeme,
>
> I added this to the GORM page: (feel free to go in and change it if
> you
> wish)
>
> Technical note for those interested:  Under the covers, only one table
> is used.  A class column specifies the subclass and any fields in the
> subclasses are included on the same table.  Subclass fields cannot be
> required because the underlying columns need to be nullable for the
> other subclasses.
>
> - Jonathan
>
> >>> [hidden email] 2006-06-13 10:00:11 AM >>>
> There is already a bit about it on the GORM page:
> http://grails.org/GORM
>
> feel free to elaborate :-)
>
> Graeme
>
> On 6/13/06, Jonathan Carlson <[hidden email]> wrote:
> > Thanks.  That'll work fine for simple stuff.  It's good to know not
> to
> > use it for more complex stuff with lots of subclass columns.  I can
> help
> > document this on the Wiki if you have a section there that mentions
> this
> > feature.
> >
> > - Jonathan
> >
> > >>> [hidden email] 2006-06-13 9:32:50 AM >>>
> > On 6/13/06, Jonathan Carlson <[hidden email]> wrote:
> > > So, if the subclass has an extra column does it create a new
> > subtable?
> > > ...Or does it add it to the main table and ignore it for the other
> > > subclasses?
> > I believe the latter, which is why one limitation is that you can't
> > have not null columns in sub-classes as they HAVE to be nullable for
> > the other classes in the relationship to continue functioning
> >
> > Graeme
> >
> > >
> > >
> > > >>> [hidden email] 2006-06-13 9:27:53 AM >>>
> > > On 6/13/06, Jonathan Carlson <[hidden email]> wrote:
> > > > Good news!  I'm curious, how does hibernate know if it is an
> > > AlphaRomeo
> > > > or a Fiat?  Does it add a column containing the class name, or
> > does
> > > it
> > > > create a new subtable for each subclass?
> > > Yes it creates a class column with the class name in.
> > >
> > > >
> > > > Does it work if Ferrari (for example) has an extra field that
> the
> > > > others don't have?  I'm guessing this would work if the subtable
> > > option
> > > > is used.
> > > Yes it does work
> > >
> > > Graeme
> > >
> > > >
> > > > - Jonathan
> > > >
> > > >
> > > > >>> [hidden email] 2006-06-12 11:48:01 AM >>>
> > > > Hi all,
> > > >
> > > > Just like to point out a recently committed feature which
> extends
> > > the
> > > > capability of inheritence mapping.
> > > >
> > > > It is now possible to define a domain model like below:
> > > >
> > > > class Car {
> > > >      Long id
> > > >      Long version
> > > >      String category
> > > >      String model
> > > > }
> > > > class AlphaRomeo extends Car {
> > > > }
> > > > class Fiat extends Car {
> > > > }
> > > > class Ferrari extends Car {
> > > > }
> > > >
> > > > And then use polymorphic dynamic finders:
> > > >
> > > > def cars = Car.findAll() // will return all alphas, fiats and
> > > ferraris
> > > > def luxuryCars = Car.findAllByCategory('luxury') // get all
> luxury
> > > > cars
> > > >
> > > > Its pretty neat :-)
> > > >
> > > > Cheers
> > > > Graeme
> > > >
> > > ___________
> > >
> > >
> >
> ______________________________________________________________________
> > > This email and any files transmitted with it are confidential and
> > > intended solely for the use of the individual or entity to whom
> they
> > > are addressed. If you have received this email in error please
> > notify
> > > the system manager.
> > >
> > > Katun Corporation -- www.katun.com
> > >
> >
> _____________________________________________________________________
> > >
> > >
> >
> ---------------------------------------------------------------------
> > > To unsubscribe from this list please visit:
> > >
> > >     http://xircles.codehaus.org/manage_email
> > >
> > >
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe from this list please visit:
> >
> >     http://xircles.codehaus.org/manage_email
> >
> >
> >
> ______________________________________________________________________
> > This email has been scanned by the MessageLabs Email Security
> System.
> > For more information please visit http://www.messagelabs.com/email
> >
> ______________________________________________________________________
> >
> >
> ______________________________________________________________________
> > This email and any files transmitted with it are confidential and
> > intended solely for the use of the individual or entity to whom they
> > are addressed. If you have received this email in error please
> notify
> > the system manager.
> >
> > Katun Corporation -- www.katun.com
> >
> _____________________________________________________________________
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe from this list please visit:
> >
> >     http://xircles.codehaus.org/manage_email
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe from this list please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>
> ______________________________________________________________________
> This email has been scanned by the MessageLabs Email Security System.
> For more information please visit http://www.messagelabs.com/email
> ______________________________________________________________________
>
> ______________________________________________________________________
> This email and any files transmitted with it are confidential and
> intended solely for the use of the individual or entity to whom they
> are addressed. If you have received this email in error please notify
> the system manager.
>
> Katun Corporation -- www.katun.com
> _____________________________________________________________________
>
> ---------------------------------------------------------------------
> To unsubscribe from this list please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>
> ______________________________________________________________________
> This email has been scanned by the MessageLabs Email Security System.
> For more information please visit http://www.messagelabs.com/email
> ______________________________________________________________________
>
> ______________________________________________________________________
> This email and any files transmitted with it are confidential and
> intended solely for the use of the individual or entity to whom they
> are addressed. If you have received this email in error please notify
> the system manager.
>
> Katun Corporation -- www.katun.com
> _____________________________________________________________________
>
> ---------------------------------------------------------------------
> To unsubscribe from this list please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply | Threaded
Open this post in threaded view
|

Re: GORM Inheritence Mapping

Guillaume Laforge-2
In reply to this post by Jonathan Carlson
If you look at the web-page (not the confluence-page), then the page
isn't updated in the minute, because it is cached. But you can appened
?nocache to the web page URL to see the updated version.

On 6/13/06, Jonathan Carlson <[hidden email]> wrote:

> Hmmm, The wiki acts like it accepts my changes but then it doesn't
> display them back to me.  Is it possible it has to be reviewed first?
> Maybe someone else will have better luck pasting the below text at the
> end of the Mapping Inheritance section
>
> - Jonathan
>
> >>> [hidden email] 2006-06-13 11:26:21 AM >>>
> Thanks Graeme,
>
> I added this to the GORM page: (feel free to go in and change it if
> you
> wish)
>
> Technical note for those interested:  Under the covers, only one table
> is used.  A class column specifies the subclass and any fields in the
> subclasses are included on the same table.  Subclass fields cannot be
> required because the underlying columns need to be nullable for the
> other subclasses.
>
> - Jonathan
>
> >>> [hidden email] 2006-06-13 10:00:11 AM >>>
> There is already a bit about it on the GORM page:
> http://grails.org/GORM
>
> feel free to elaborate :-)
>
> Graeme
>
> On 6/13/06, Jonathan Carlson <[hidden email]> wrote:
> > Thanks.  That'll work fine for simple stuff.  It's good to know not
> to
> > use it for more complex stuff with lots of subclass columns.  I can
> help
> > document this on the Wiki if you have a section there that mentions
> this
> > feature.
> >
> > - Jonathan
> >
> > >>> [hidden email] 2006-06-13 9:32:50 AM >>>
> > On 6/13/06, Jonathan Carlson <[hidden email]> wrote:
> > > So, if the subclass has an extra column does it create a new
> > subtable?
> > > ...Or does it add it to the main table and ignore it for the other
> > > subclasses?
> > I believe the latter, which is why one limitation is that you can't
> > have not null columns in sub-classes as they HAVE to be nullable for
> > the other classes in the relationship to continue functioning
> >
> > Graeme
> >
> > >
> > >
> > > >>> [hidden email] 2006-06-13 9:27:53 AM >>>
> > > On 6/13/06, Jonathan Carlson <[hidden email]> wrote:
> > > > Good news!  I'm curious, how does hibernate know if it is an
> > > AlphaRomeo
> > > > or a Fiat?  Does it add a column containing the class name, or
> > does
> > > it
> > > > create a new subtable for each subclass?
> > > Yes it creates a class column with the class name in.
> > >
> > > >
> > > > Does it work if Ferrari (for example) has an extra field that
> the
> > > > others don't have?  I'm guessing this would work if the subtable
> > > option
> > > > is used.
> > > Yes it does work
> > >
> > > Graeme
> > >
> > > >
> > > > - Jonathan
> > > >
> > > >
> > > > >>> [hidden email] 2006-06-12 11:48:01 AM >>>
> > > > Hi all,
> > > >
> > > > Just like to point out a recently committed feature which
> extends
> > > the
> > > > capability of inheritence mapping.
> > > >
> > > > It is now possible to define a domain model like below:
> > > >
> > > > class Car {
> > > >      Long id
> > > >      Long version
> > > >      String category
> > > >      String model
> > > > }
> > > > class AlphaRomeo extends Car {
> > > > }
> > > > class Fiat extends Car {
> > > > }
> > > > class Ferrari extends Car {
> > > > }
> > > >
> > > > And then use polymorphic dynamic finders:
> > > >
> > > > def cars = Car.findAll() // will return all alphas, fiats and
> > > ferraris
> > > > def luxuryCars = Car.findAllByCategory('luxury') // get all
> luxury
> > > > cars
> > > >
> > > > Its pretty neat :-)
> > > >
> > > > Cheers
> > > > Graeme
> > > >
> > > ___________
> > >
> > >
> >
> ______________________________________________________________________
> > > This email and any files transmitted with it are confidential and
> > > intended solely for the use of the individual or entity to whom
> they
> > > are addressed. If you have received this email in error please
> > notify
> > > the system manager.
> > >
> > > Katun Corporation -- www.katun.com
> > >
> >
> _____________________________________________________________________
> > >
> > >
> >
> ---------------------------------------------------------------------
> > > To unsubscribe from this list please visit:
> > >
> > >     http://xircles.codehaus.org/manage_email
> > >
> > >
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe from this list please visit:
> >
> >     http://xircles.codehaus.org/manage_email
> >
> >
> >
> ______________________________________________________________________
> > This email has been scanned by the MessageLabs Email Security
> System.
> > For more information please visit http://www.messagelabs.com/email
> >
> ______________________________________________________________________
> >
> >
> ______________________________________________________________________
> > This email and any files transmitted with it are confidential and
> > intended solely for the use of the individual or entity to whom they
> > are addressed. If you have received this email in error please
> notify
> > the system manager.
> >
> > Katun Corporation -- www.katun.com
> >
> _____________________________________________________________________
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe from this list please visit:
> >
> >     http://xircles.codehaus.org/manage_email
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe from this list please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>
> ______________________________________________________________________
> This email has been scanned by the MessageLabs Email Security System.
> For more information please visit http://www.messagelabs.com/email
> ______________________________________________________________________
>
> ______________________________________________________________________
> This email and any files transmitted with it are confidential and
> intended solely for the use of the individual or entity to whom they
> are addressed. If you have received this email in error please notify
> the system manager.
>
> Katun Corporation -- www.katun.com
> _____________________________________________________________________
>
> ---------------------------------------------------------------------
> To unsubscribe from this list please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>
> ______________________________________________________________________
> This email has been scanned by the MessageLabs Email Security System.
> For more information please visit http://www.messagelabs.com/email
> ______________________________________________________________________
>
> ______________________________________________________________________
> This email and any files transmitted with it are confidential and
> intended solely for the use of the individual or entity to whom they
> are addressed. If you have received this email in error please notify
> the system manager.
>
> Katun Corporation -- www.katun.com
> _____________________________________________________________________
>
> ---------------------------------------------------------------------
> To unsubscribe from this list please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>


--
Guillaume Laforge
Groovy Project Manager
http://glaforge.free.fr/blog/groovy

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply | Threaded
Open this post in threaded view
|

Re: GORM Inheritence Mapping

graemer
Apparently it is now ?nc not ?nocache

Graeme

On 6/13/06, Guillaume Laforge <[hidden email]> wrote:

> If you look at the web-page (not the confluence-page), then the page
> isn't updated in the minute, because it is cached. But you can appened
> ?nocache to the web page URL to see the updated version.
>
> On 6/13/06, Jonathan Carlson <[hidden email]> wrote:
> > Hmmm, The wiki acts like it accepts my changes but then it doesn't
> > display them back to me.  Is it possible it has to be reviewed first?
> > Maybe someone else will have better luck pasting the below text at the
> > end of the Mapping Inheritance section
> >
> > - Jonathan
> >
> > >>> [hidden email] 2006-06-13 11:26:21 AM >>>
> > Thanks Graeme,
> >
> > I added this to the GORM page: (feel free to go in and change it if
> > you
> > wish)
> >
> > Technical note for those interested:  Under the covers, only one table
> > is used.  A class column specifies the subclass and any fields in the
> > subclasses are included on the same table.  Subclass fields cannot be
> > required because the underlying columns need to be nullable for the
> > other subclasses.
> >
> > - Jonathan
> >
> > >>> [hidden email] 2006-06-13 10:00:11 AM >>>
> > There is already a bit about it on the GORM page:
> > http://grails.org/GORM
> >
> > feel free to elaborate :-)
> >
> > Graeme
> >
> > On 6/13/06, Jonathan Carlson <[hidden email]> wrote:
> > > Thanks.  That'll work fine for simple stuff.  It's good to know not
> > to
> > > use it for more complex stuff with lots of subclass columns.  I can
> > help
> > > document this on the Wiki if you have a section there that mentions
> > this
> > > feature.
> > >
> > > - Jonathan
> > >
> > > >>> [hidden email] 2006-06-13 9:32:50 AM >>>
> > > On 6/13/06, Jonathan Carlson <[hidden email]> wrote:
> > > > So, if the subclass has an extra column does it create a new
> > > subtable?
> > > > ...Or does it add it to the main table and ignore it for the other
> > > > subclasses?
> > > I believe the latter, which is why one limitation is that you can't
> > > have not null columns in sub-classes as they HAVE to be nullable for
> > > the other classes in the relationship to continue functioning
> > >
> > > Graeme
> > >
> > > >
> > > >
> > > > >>> [hidden email] 2006-06-13 9:27:53 AM >>>
> > > > On 6/13/06, Jonathan Carlson <[hidden email]> wrote:
> > > > > Good news!  I'm curious, how does hibernate know if it is an
> > > > AlphaRomeo
> > > > > or a Fiat?  Does it add a column containing the class name, or
> > > does
> > > > it
> > > > > create a new subtable for each subclass?
> > > > Yes it creates a class column with the class name in.
> > > >
> > > > >
> > > > > Does it work if Ferrari (for example) has an extra field that
> > the
> > > > > others don't have?  I'm guessing this would work if the subtable
> > > > option
> > > > > is used.
> > > > Yes it does work
> > > >
> > > > Graeme
> > > >
> > > > >
> > > > > - Jonathan
> > > > >
> > > > >
> > > > > >>> [hidden email] 2006-06-12 11:48:01 AM >>>
> > > > > Hi all,
> > > > >
> > > > > Just like to point out a recently committed feature which
> > extends
> > > > the
> > > > > capability of inheritence mapping.
> > > > >
> > > > > It is now possible to define a domain model like below:
> > > > >
> > > > > class Car {
> > > > >      Long id
> > > > >      Long version
> > > > >      String category
> > > > >      String model
> > > > > }
> > > > > class AlphaRomeo extends Car {
> > > > > }
> > > > > class Fiat extends Car {
> > > > > }
> > > > > class Ferrari extends Car {
> > > > > }
> > > > >
> > > > > And then use polymorphic dynamic finders:
> > > > >
> > > > > def cars = Car.findAll() // will return all alphas, fiats and
> > > > ferraris
> > > > > def luxuryCars = Car.findAllByCategory('luxury') // get all
> > luxury
> > > > > cars
> > > > >
> > > > > Its pretty neat :-)
> > > > >
> > > > > Cheers
> > > > > Graeme
> > > > >
> > > > ___________
> > > >
> > > >
> > >
> > ______________________________________________________________________
> > > > This email and any files transmitted with it are confidential and
> > > > intended solely for the use of the individual or entity to whom
> > they
> > > > are addressed. If you have received this email in error please
> > > notify
> > > > the system manager.
> > > >
> > > > Katun Corporation -- www.katun.com
> > > >
> > >
> > _____________________________________________________________________
> > > >
> > > >
> > >
> > ---------------------------------------------------------------------
> > > > To unsubscribe from this list please visit:
> > > >
> > > >     http://xircles.codehaus.org/manage_email
> > > >
> > > >
> > >
> > >
> > ---------------------------------------------------------------------
> > > To unsubscribe from this list please visit:
> > >
> > >     http://xircles.codehaus.org/manage_email
> > >
> > >
> > >
> > ______________________________________________________________________
> > > This email has been scanned by the MessageLabs Email Security
> > System.
> > > For more information please visit http://www.messagelabs.com/email
> > >
> > ______________________________________________________________________
> > >
> > >
> > ______________________________________________________________________
> > > This email and any files transmitted with it are confidential and
> > > intended solely for the use of the individual or entity to whom they
> > > are addressed. If you have received this email in error please
> > notify
> > > the system manager.
> > >
> > > Katun Corporation -- www.katun.com
> > >
> > _____________________________________________________________________
> > >
> > >
> > ---------------------------------------------------------------------
> > > To unsubscribe from this list please visit:
> > >
> > >     http://xircles.codehaus.org/manage_email
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe from this list please visit:
> >
> >     http://xircles.codehaus.org/manage_email
> >
> >
> > ______________________________________________________________________
> > This email has been scanned by the MessageLabs Email Security System.
> > For more information please visit http://www.messagelabs.com/email
> > ______________________________________________________________________
> >
> > ______________________________________________________________________
> > This email and any files transmitted with it are confidential and
> > intended solely for the use of the individual or entity to whom they
> > are addressed. If you have received this email in error please notify
> > the system manager.
> >
> > Katun Corporation -- www.katun.com
> > _____________________________________________________________________
> >
> > ---------------------------------------------------------------------
> > To unsubscribe from this list please visit:
> >
> >     http://xircles.codehaus.org/manage_email
> >
> >
> > ______________________________________________________________________
> > This email has been scanned by the MessageLabs Email Security System.
> > For more information please visit http://www.messagelabs.com/email
> > ______________________________________________________________________
> >
> > ______________________________________________________________________
> > This email and any files transmitted with it are confidential and
> > intended solely for the use of the individual or entity to whom they
> > are addressed. If you have received this email in error please notify
> > the system manager.
> >
> > Katun Corporation -- www.katun.com
> > _____________________________________________________________________
> >
> > ---------------------------------------------------------------------
> > To unsubscribe from this list please visit:
> >
> >     http://xircles.codehaus.org/manage_email
> >
> >
>
>
> --
> Guillaume Laforge
> Groovy Project Manager
> http://glaforge.free.fr/blog/groovy
>
> ---------------------------------------------------------------------
> To unsubscribe from this list please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply | Threaded
Open this post in threaded view
|

Re: GORM Inheritence Mapping

Guillaume Laforge-2
ah really? good to know :-)

On 6/13/06, Graeme Rocher <[hidden email]> wrote:

> Apparently it is now ?nc not ?nocache
>
> Graeme
>
> On 6/13/06, Guillaume Laforge <[hidden email]> wrote:
> > If you look at the web-page (not the confluence-page), then the page
> > isn't updated in the minute, because it is cached. But you can appened
> > ?nocache to the web page URL to see the updated version.
> >
> > On 6/13/06, Jonathan Carlson <[hidden email]> wrote:
> > > Hmmm, The wiki acts like it accepts my changes but then it doesn't
> > > display them back to me.  Is it possible it has to be reviewed first?
> > > Maybe someone else will have better luck pasting the below text at the
> > > end of the Mapping Inheritance section
> > >
> > > - Jonathan
> > >
> > > >>> [hidden email] 2006-06-13 11:26:21 AM >>>
> > > Thanks Graeme,
> > >
> > > I added this to the GORM page: (feel free to go in and change it if
> > > you
> > > wish)
> > >
> > > Technical note for those interested:  Under the covers, only one table
> > > is used.  A class column specifies the subclass and any fields in the
> > > subclasses are included on the same table.  Subclass fields cannot be
> > > required because the underlying columns need to be nullable for the
> > > other subclasses.
> > >
> > > - Jonathan
> > >
> > > >>> [hidden email] 2006-06-13 10:00:11 AM >>>
> > > There is already a bit about it on the GORM page:
> > > http://grails.org/GORM
> > >
> > > feel free to elaborate :-)
> > >
> > > Graeme
> > >
> > > On 6/13/06, Jonathan Carlson <[hidden email]> wrote:
> > > > Thanks.  That'll work fine for simple stuff.  It's good to know not
> > > to
> > > > use it for more complex stuff with lots of subclass columns.  I can
> > > help
> > > > document this on the Wiki if you have a section there that mentions
> > > this
> > > > feature.
> > > >
> > > > - Jonathan
> > > >
> > > > >>> [hidden email] 2006-06-13 9:32:50 AM >>>
> > > > On 6/13/06, Jonathan Carlson <[hidden email]> wrote:
> > > > > So, if the subclass has an extra column does it create a new
> > > > subtable?
> > > > > ...Or does it add it to the main table and ignore it for the other
> > > > > subclasses?
> > > > I believe the latter, which is why one limitation is that you can't
> > > > have not null columns in sub-classes as they HAVE to be nullable for
> > > > the other classes in the relationship to continue functioning
> > > >
> > > > Graeme
> > > >
> > > > >
> > > > >
> > > > > >>> [hidden email] 2006-06-13 9:27:53 AM >>>
> > > > > On 6/13/06, Jonathan Carlson <[hidden email]> wrote:
> > > > > > Good news!  I'm curious, how does hibernate know if it is an
> > > > > AlphaRomeo
> > > > > > or a Fiat?  Does it add a column containing the class name, or
> > > > does
> > > > > it
> > > > > > create a new subtable for each subclass?
> > > > > Yes it creates a class column with the class name in.
> > > > >
> > > > > >
> > > > > > Does it work if Ferrari (for example) has an extra field that
> > > the
> > > > > > others don't have?  I'm guessing this would work if the subtable
> > > > > option
> > > > > > is used.
> > > > > Yes it does work
> > > > >
> > > > > Graeme
> > > > >
> > > > > >
> > > > > > - Jonathan
> > > > > >
> > > > > >
> > > > > > >>> [hidden email] 2006-06-12 11:48:01 AM >>>
> > > > > > Hi all,
> > > > > >
> > > > > > Just like to point out a recently committed feature which
> > > extends
> > > > > the
> > > > > > capability of inheritence mapping.
> > > > > >
> > > > > > It is now possible to define a domain model like below:
> > > > > >
> > > > > > class Car {
> > > > > >      Long id
> > > > > >      Long version
> > > > > >      String category
> > > > > >      String model
> > > > > > }
> > > > > > class AlphaRomeo extends Car {
> > > > > > }
> > > > > > class Fiat extends Car {
> > > > > > }
> > > > > > class Ferrari extends Car {
> > > > > > }
> > > > > >
> > > > > > And then use polymorphic dynamic finders:
> > > > > >
> > > > > > def cars = Car.findAll() // will return all alphas, fiats and
> > > > > ferraris
> > > > > > def luxuryCars = Car.findAllByCategory('luxury') // get all
> > > luxury
> > > > > > cars
> > > > > >
> > > > > > Its pretty neat :-)
> > > > > >
> > > > > > Cheers
> > > > > > Graeme
> > > > > >
> > > > > ___________
> > > > >
> > > > >
> > > >
> > > ______________________________________________________________________
> > > > > This email and any files transmitted with it are confidential and
> > > > > intended solely for the use of the individual or entity to whom
> > > they
> > > > > are addressed. If you have received this email in error please
> > > > notify
> > > > > the system manager.
> > > > >
> > > > > Katun Corporation -- www.katun.com
> > > > >
> > > >
> > > _____________________________________________________________________
> > > > >
> > > > >
> > > >
> > > ---------------------------------------------------------------------
> > > > > To unsubscribe from this list please visit:
> > > > >
> > > > >     http://xircles.codehaus.org/manage_email
> > > > >
> > > > >
> > > >
> > > >
> > > ---------------------------------------------------------------------
> > > > To unsubscribe from this list please visit:
> > > >
> > > >     http://xircles.codehaus.org/manage_email
> > > >
> > > >
> > > >
> > > ______________________________________________________________________
> > > > This email has been scanned by the MessageLabs Email Security
> > > System.
> > > > For more information please visit http://www.messagelabs.com/email
> > > >
> > > ______________________________________________________________________
> > > >
> > > >
> > > ______________________________________________________________________
> > > > This email and any files transmitted with it are confidential and
> > > > intended solely for the use of the individual or entity to whom they
> > > > are addressed. If you have received this email in error please
> > > notify
> > > > the system manager.
> > > >
> > > > Katun Corporation -- www.katun.com
> > > >
> > > _____________________________________________________________________
> > > >
> > > >
> > > ---------------------------------------------------------------------
> > > > To unsubscribe from this list please visit:
> > > >
> > > >     http://xircles.codehaus.org/manage_email
> > > >
> > > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe from this list please visit:
> > >
> > >     http://xircles.codehaus.org/manage_email
> > >
> > >
> > > ______________________________________________________________________
> > > This email has been scanned by the MessageLabs Email Security System.
> > > For more information please visit http://www.messagelabs.com/email
> > > ______________________________________________________________________
> > >
> > > ______________________________________________________________________
> > > This email and any files transmitted with it are confidential and
> > > intended solely for the use of the individual or entity to whom they
> > > are addressed. If you have received this email in error please notify
> > > the system manager.
> > >
> > > Katun Corporation -- www.katun.com
> > > _____________________________________________________________________
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe from this list please visit:
> > >
> > >     http://xircles.codehaus.org/manage_email
> > >
> > >
> > > ______________________________________________________________________
> > > This email has been scanned by the MessageLabs Email Security System.
> > > For more information please visit http://www.messagelabs.com/email
> > > ______________________________________________________________________
> > >
> > > ______________________________________________________________________
> > > This email and any files transmitted with it are confidential and
> > > intended solely for the use of the individual or entity to whom they
> > > are addressed. If you have received this email in error please notify
> > > the system manager.
> > >
> > > Katun Corporation -- www.katun.com
> > > _____________________________________________________________________
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe from this list please visit:
> > >
> > >     http://xircles.codehaus.org/manage_email
> > >
> > >
> >
> >
> > --
> > Guillaume Laforge
> > Groovy Project Manager
> > http://glaforge.free.fr/blog/groovy
> >
> > ---------------------------------------------------------------------
> > To unsubscribe from this list please visit:
> >
> >     http://xircles.codehaus.org/manage_email
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe from this list please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>


--
Guillaume Laforge
Groovy Project Manager
http://glaforge.free.fr/blog/groovy

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email