Taking grails for a quick spin...

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Taking grails for a quick spin...

Jonathan Carlson
Thank you Steven and Graeme for your earlier answers.  I probably should
have noticed the layouts in the documentation.

So I decided to take it for a spin with really simple Thread and
Message domain classes and super-basic scaffolded controllers.  Do you
have any ideas about this error when I tried to run the app?:

   [groovy] Context initialization failed
   [groovy] org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'sessionFactory' defined in resource
loaded through InputStream: Initialization of bean failed; nested
exception is org.hibernate.MappingException: property mapping has wrong
number of columns: Thread.relatesToMany type: object
   [groovy] org.hibernate.MappingException: property mapping has wrong
number of columns: Thread.relatesToMany type: object
   [groovy]     at
org.hibernate.mapping.PersistentClass.validate(PersistentClass.java:396)
   [groovy]     at
org.hibernate.mapping.RootClass.validate(RootClass.java:192)
   [groovy]     at
org.hibernate.cfg.Configuration.validate(Configuration.java:984)

class Thread {
  @Property Long id;
  @Property Long version;  
  @Property relatesToMany = [messages : Message.class];  
  @Property String title;
  @Property Set messages;
}

class Message {
  @Property Long id;
  @Property Long version;  
  @Property Thread thread;
  @Property String userName;
  @Property Date date;
  @Property String text;  
  @Property constraints = {
        text(widget:'textarea', length:0..2000)
  }
}

______________________________________________________________________
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
_____________________________________________________________________
Reply | Threaded
Open this post in threaded view
|

Re: Taking grails for a quick spin...

Jonathan Carlson
I changed "@Property relatesToMany" to "Map relatesToMany" and it seems
to work now.  The documentation should be updated.  Thanks!

  Map relatesToMany = [ messages : Message.class];

- Jonathan



>>> [hidden email] 2006-03-16 3:27:33 PM >>>
Thank you Steven and Graeme for your earlier answers.  I probably
should
have noticed the layouts in the documentation.

So I decided to take it for a spin with really simple Thread and
Message domain classes and super-basic scaffolded controllers.  Do you
have any ideas about this error when I tried to run the app?:

   [groovy] Context initialization failed
   [groovy] org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'sessionFactory' defined in resource
loaded through InputStream: Initialization of bean failed; nested
exception is org.hibernate.MappingException: property mapping has
wrong
number of columns: Thread.relatesToMany type: object
   [groovy] org.hibernate.MappingException: property mapping has wrong
number of columns: Thread.relatesToMany type: object
   [groovy]     at
org.hibernate.mapping.PersistentClass.validate(PersistentClass.java:396)
   [groovy]     at
org.hibernate.mapping.RootClass.validate(RootClass.java:192)
   [groovy]     at
org.hibernate.cfg.Configuration.validate(Configuration.java:984)

class Thread {
  @Property Long id;
  @Property Long version;  
  @Property relatesToMany = [messages : Message.class];  
  @Property String title;
  @Property Set messages;
}

class Message {
  @Property Long id;
  @Property Long version;  
  @Property Thread thread;
  @Property String userName;
  @Property Date date;
  @Property String text;  
  @Property constraints = {
        text(widget:'textarea', length:0..2000)
  }
}

______________________________________________________________________
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
_____________________________________________________________________

______________________________________________________________________
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
_____________________________________________________________________
Reply | Threaded
Open this post in threaded view
|

Re: Taking grails for a quick spin...

graemer
On 3/16/06, Jonathan Carlson <[hidden email]> wrote:
> I changed "@Property relatesToMany" to "Map relatesToMany" and it seems
> to work now.  The documentation should be updated.  Thanks!
>
>   Map relatesToMany = [ messages : Message.class];

Hmm this shouldn't actually work and I'm surprised that it did as you
have defined a field not a javabean property. I will try out your
previous example as it may work my one concern though is that as
grails doesn't support the concept of packages just yet and you've
named your class Thread it might conflict with java.lang.Thread

I will get back to you as soon as I've tried your example

Cheers

Graeme

>
> - Jonathan
>
>
>
> >>> [hidden email] 2006-03-16 3:27:33 PM >>>
> Thank you Steven and Graeme for your earlier answers.  I probably
> should
> have noticed the layouts in the documentation.
>
> So I decided to take it for a spin with really simple Thread and
> Message domain classes and super-basic scaffolded controllers.  Do you
> have any ideas about this error when I tried to run the app?:
>
>    [groovy] Context initialization failed
>    [groovy] org.springframework.beans.factory.BeanCreationException:
> Error creating bean with name 'sessionFactory' defined in resource
> loaded through InputStream: Initialization of bean failed; nested
> exception is org.hibernate.MappingException: property mapping has
> wrong
> number of columns: Thread.relatesToMany type: object
>    [groovy] org.hibernate.MappingException: property mapping has wrong
> number of columns: Thread.relatesToMany type: object
>    [groovy]     at
> org.hibernate.mapping.PersistentClass.validate(PersistentClass.java:396)
>    [groovy]     at
> org.hibernate.mapping.RootClass.validate(RootClass.java:192)
>    [groovy]     at
> org.hibernate.cfg.Configuration.validate(Configuration.java:984)
>
> class Thread {
>   @Property Long id;
>   @Property Long version;
>   @Property relatesToMany = [messages : Message.class];
>   @Property String title;
>   @Property Set messages;
> }
>
> class Message {
>   @Property Long id;
>   @Property Long version;
>   @Property Thread thread;
>   @Property String userName;
>   @Property Date date;
>   @Property String text;
>   @Property constraints = {
>         text(widget:'textarea', length:0..2000)
>   }
> }
>
> ______________________________________________________________________
> 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
> _____________________________________________________________________
>
> ______________________________________________________________________
> 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
> _____________________________________________________________________
>