Newbie GRAILS-Hibernate Integration Problems

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

Newbie GRAILS-Hibernate Integration Problems

John Winn
Hi,

I am looking at GRAILS to develop a web app as the front-end for an
analytical database and server. The server uses Hibernate 3 to
communicate with the legacy database.

 

I am testing out hibernate with GRAILS as GRAILS offers exactly what I
am after, a simple framework for creating my web app. However I am
coming up with a few issues that I hope that someone has come up against
before (I know GRAILS is new etc..).

 

Firstly, when I put hibernate into my app, I get the following error. It
seems only to occur when it is looking at relationships in my hibernate
objects. I have tried using only part of my schema which is fine that
does not have these relationships, but when it has a lot of relations,
which my legacy database has, the below occurs:

 

   [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 java.lang.NullPointerException: null

   [groovy] java.lang.NullPointerException

   [groovy]               at
org.codehaus.groovy.grails.orm.hibernate.cfg.GrailsDomainConfigurationUt
il.configureDomainClassRelationships(GrailsDomainConfigurationUtil.java:
70)

   [groovy]               at
org.codehaus.groovy.grails.commons.DefaultGrailsApplication.configureDom
ainClassRelationships(DefaultGrailsApplication.java:334)

   [groovy]               at
org.codehaus.groovy.grails.commons.DefaultGrailsApplication.addDomainCla
ss(DefaultGrailsApplication.java:276)

   [groovy]               at
org.codehaus.groovy.grails.orm.hibernate.cfg.GrailsDomainConfigurationUt
il.configureDynamicMethods(GrailsDomainConfigurationUtil.java:98)

   [groovy]               at
org.codehaus.groovy.grails.orm.hibernate.cfg.DefaultGrailsDomainConfigur
ation.configureDynamicMethods(DefaultGrailsDomainConfiguration.java:101)

 

Secondly, the legacy database has a lot of data in it, and perhaps as a
result of the above, when I start GRAILS app, it tends to delete all of
my data. Is this hbm2ddl? Is this possible to turn off as I don't want
to change the database schema at all? I want GRAILS to plug into my
existing schema and not to change it at all.

 

GRAILS looks fantastic, and if I can get over these hurdles, I can't
wait to start implementing it!

 

   
Reply | Threaded
Open this post in threaded view
|

RE: Newbie GRAILS-Hibernate Integration Problems

Dierk König
Hi,

welcome to Grails.

> Firstly, when I put hibernate into my app,

what are you exactly doing at this point?

You may want to look at the 'recipe' sample to see how exiting
Java models and hibernate mappings can be used.

> Secondly, the legacy database has a lot of data in it, and perhaps as a
> result of the above, when I start GRAILS app, it tends to delete all of
> my data. Is this hbm2ddl? Is this possible to turn off as I don't want
> to change the database schema at all? I want GRAILS to plug into my
> existing schema and not to change it at all.

go to grails-app/conf/ApplicationConfiguration.groovy and change the
'dbCreate' property to 'update'.
The value maps to the hibernates hbm2ddl.auto property.

> GRAILS looks fantastic, and if I can get over these hurdles, I can't
> wait to start implementing it!

Thanks.

have fun
Mittie
Reply | Threaded
Open this post in threaded view
|

Re: Newbie GRAILS-Hibernate Integration Problems

graemer
In reply to this post by John Winn
On 3/16/06, John Winn <[hidden email]> wrote:
> Hi,
>
> I am looking at GRAILS to develop a web app as the front-end for an
> analytical database and server. The server uses Hibernate 3 to
> communicate with the legacy database.
Excellent, I would be really interested to know how this progresses
(if it does) as I have only used Grails against relatively simple
Hibernate domain models.

>
>
>
> I am testing out hibernate with GRAILS as GRAILS offers exactly what I
> am after, a simple framework for creating my web app. However I am
> coming up with a few issues that I hope that someone has come up against
> before (I know GRAILS is new etc..).
Unlikely, as Grails is new ;-)

>
>
>
> Firstly, when I put hibernate into my app, I get the following error. It
> seems only to occur when it is looking at relationships in my hibernate
> objects. I have tried using only part of my schema which is fine that
> does not have these relationships, but when it has a lot of relations,
> which my legacy database has, the below occurs:
I've fixed this in CVS head by adding an additional null check, let me
know if this solves the problem

>
>
>
>    [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 java.lang.NullPointerException: null
>
>    [groovy] java.lang.NullPointerException
>
>    [groovy]               at
> org.codehaus.groovy.grails.orm.hibernate.cfg.GrailsDomainConfigurationUt
> il.configureDomainClassRelationships(GrailsDomainConfigurationUtil.java:
> 70)
>
>    [groovy]               at
> org.codehaus.groovy.grails.commons.DefaultGrailsApplication.configureDom
> ainClassRelationships(DefaultGrailsApplication.java:334)
>
>    [groovy]               at
> org.codehaus.groovy.grails.commons.DefaultGrailsApplication.addDomainCla
> ss(DefaultGrailsApplication.java:276)
>
>    [groovy]               at
> org.codehaus.groovy.grails.orm.hibernate.cfg.GrailsDomainConfigurationUt
> il.configureDynamicMethods(GrailsDomainConfigurationUtil.java:98)
>
>    [groovy]               at
> org.codehaus.groovy.grails.orm.hibernate.cfg.DefaultGrailsDomainConfigur
> ation.configureDynamicMethods(DefaultGrailsDomainConfiguration.java:101)
>
>
>
> Secondly, the legacy database has a lot of data in it, and perhaps as a
> result of the above, when I start GRAILS app, it tends to delete all of
> my data. Is this hbm2ddl? Is this possible to turn off as I don't want
> to change the database schema at all? I want GRAILS to plug into my
> existing schema and not to change it at all.
2 options, remove the 'dbCreate' property from the
'grails-app/conf/ApplicationDataSource.groovy' file or customise it to
what you want. This maps to the hbm2dll settings in hibernate

>
>
>
> GRAILS looks fantastic, and if I can get over these hurdles, I can't
> wait to start implementing it!
We look forward to hearing your experiences :-)

Graeme

>
>
>
>
>
Reply | Threaded
Open this post in threaded view
|

RE: Newbie GRAILS-Hibernate Integration Problems

John Winn
In reply to this post by John Winn
RE: [grails-user] Newbie GRAILS-Hibernate Integration Problems

Hi,
Thanks for the comments and your help, and I have tested it out but it seems the error moved down a few lines. I looked at the code and it looks like referencedProperties[k].getReferencedPropertyType() is null in the IF statement that follows and hence there is another NullPointerExcption error. I quickly dropped in another null check on that as well on my own machine to get it working, and have just ran up the test and I dont get any error anymore, though I am not sure if that affects the logic or not..

Thanks again for your help.





-----Original Message-----
From: [hidden email] on behalf of Graeme Rocher
Sent: Fri 17/03/2006 8:21 PM
To: [hidden email]
Subject: Re: [grails-user] Newbie GRAILS-Hibernate Integration Problems

On 3/16/06, John Winn <[hidden email]> wrote:
> Hi,
>
> I am looking at GRAILS to develop a web app as the front-end for an
> analytical database and server. The server uses Hibernate 3 to
> communicate with the legacy database.
Excellent, I would be really interested to know how this progresses
(if it does) as I have only used Grails against relatively simple
Hibernate domain models.

>
>
>
> I am testing out hibernate with GRAILS as GRAILS offers exactly what I
> am after, a simple framework for creating my web app. However I am
> coming up with a few issues that I hope that someone has come up against
> before (I know GRAILS is new etc..).
Unlikely, as Grails is new ;-)

>
>
>
> Firstly, when I put hibernate into my app, I get the following error. It
> seems only to occur when it is looking at relationships in my hibernate
> objects. I have tried using only part of my schema which is fine that
> does not have these relationships, but when it has a lot of relations,
> which my legacy database has, the below occurs:
I've fixed this in CVS head by adding an additional null check, let me
know if this solves the problem

>
>
>
>    [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 java.lang.NullPointerException: null
>
>    [groovy] java.lang.NullPointerException
>
>    [groovy]               at
> org.codehaus.groovy.grails.orm.hibernate.cfg.GrailsDomainConfigurationUt
> il.configureDomainClassRelationships(GrailsDomainConfigurationUtil.java:
> 70)
>
>    [groovy]               at
> org.codehaus.groovy.grails.commons.DefaultGrailsApplication.configureDom
> ainClassRelationships(DefaultGrailsApplication.java:334)
>
>    [groovy]               at
> org.codehaus.groovy.grails.commons.DefaultGrailsApplication.addDomainCla
> ss(DefaultGrailsApplication.java:276)
>
>    [groovy]               at
> org.codehaus.groovy.grails.orm.hibernate.cfg.GrailsDomainConfigurationUt
> il.configureDynamicMethods(GrailsDomainConfigurationUtil.java:98)
>
>    [groovy]               at
> org.codehaus.groovy.grails.orm.hibernate.cfg.DefaultGrailsDomainConfigur
> ation.configureDynamicMethods(DefaultGrailsDomainConfiguration.java:101)
>
>
>
> Secondly, the legacy database has a lot of data in it, and perhaps as a
> result of the above, when I start GRAILS app, it tends to delete all of
> my data. Is this hbm2ddl? Is this possible to turn off as I don't want
> to change the database schema at all? I want GRAILS to plug into my
> existing schema and not to change it at all.
2 options, remove the 'dbCreate' property from the
'grails-app/conf/ApplicationDataSource.groovy' file or customise it to
what you want. This maps to the hbm2dll settings in hibernate

>
>
>
> GRAILS looks fantastic, and if I can get over these hurdles, I can't
> wait to start implementing it!
We look forward to hearing your experiences :-)

Graeme

>
>
>
>
>


Reply | Threaded
Open this post in threaded view
|

RE: Newbie GRAILS-Hibernate Integration Problems

John Winn
In reply to this post by John Winn
Hi again,

Thanks for the recommendation for the recipe saple, it helped a lot.

However I have run both of them up (my app and the recipe sample) and I seem to be getting this problem below.

HTTP ERROR: 404
/WEB-INF/grails-app/views//version/list.jsp
RequestURI=/test-app/version/list

This error is what I am getting when I try to execute list with scaffolding turned on (an object in my database called "version", but in the recipe sample just replace the word "version" with "sample").  

I checked in the tmp/war directory for the view folders that it generates, and I notice that the full package name as to directoy name (e.g. com.recipes.Recipe), yet the URI maps to "//version/list.jsp"

Is there anyway to get around this?

Thanks for your help, your previous help was excellent as I am now seeing my domain models getting interacting fine with the current data, but i want to test it using scaffolding first before I can finish this web app.






-----Original Message-----
From: Dierk Koenig [mailto:[hidden email]]
Sent: Fri 17/03/2006 7:42 PM
To: [hidden email]
Subject: RE: [grails-user] Newbie GRAILS-Hibernate Integration Problems
 
Hi,

welcome to Grails.

> Firstly, when I put hibernate into my app,

what are you exactly doing at this point?

You may want to look at the 'recipe' sample to see how exiting
Java models and hibernate mappings can be used.

> Secondly, the legacy database has a lot of data in it, and perhaps as a
> result of the above, when I start GRAILS app, it tends to delete all of
> my data. Is this hbm2ddl? Is this possible to turn off as I don't want
> to change the database schema at all? I want GRAILS to plug into my
> existing schema and not to change it at all.

go to grails-app/conf/ApplicationConfiguration.groovy and change the
'dbCreate' property to 'update'.
The value maps to the hibernates hbm2ddl.auto property.

> GRAILS looks fantastic, and if I can get over these hurdles, I can't
> wait to start implementing it!

Thanks.

have fun
Mittie

Reply | Threaded
Open this post in threaded view
|

Re: Newbie GRAILS-Hibernate Integration Problems

graemer
This is now fixed in CVS head. Thanks for the report

Graeme

On 3/18/06, John Winn <[hidden email]> wrote:

> Hi again,
>
> Thanks for the recommendation for the recipe saple, it helped a lot.
>
> However I have run both of them up (my app and the recipe sample) and I seem to be getting this problem below.
>
> HTTP ERROR: 404
> /WEB-INF/grails-app/views//version/list.jsp
> RequestURI=/test-app/version/list
>
> This error is what I am getting when I try to execute list with scaffolding turned on (an object in my database called "version", but in the recipe sample just replace the word "version" with "sample").
>
> I checked in the tmp/war directory for the view folders that it generates, and I notice that the full package name as to directoy name (e.g. com.recipes.Recipe), yet the URI maps to "//version/list.jsp"
>
> Is there anyway to get around this?
>
> Thanks for your help, your previous help was excellent as I am now seeing my domain models getting interacting fine with the current data, but i want to test it using scaffolding first before I can finish this web app.
>
>
>
>
>
>
> -----Original Message-----
> From: Dierk Koenig [mailto:[hidden email]]
> Sent: Fri 17/03/2006 7:42 PM
> To: [hidden email]
> Subject: RE: [grails-user] Newbie GRAILS-Hibernate Integration Problems
>
> Hi,
>
> welcome to Grails.
>
> > Firstly, when I put hibernate into my app,
>
> what are you exactly doing at this point?
>
> You may want to look at the 'recipe' sample to see how exiting
> Java models and hibernate mappings can be used.
>
> > Secondly, the legacy database has a lot of data in it, and perhaps as a
> > result of the above, when I start GRAILS app, it tends to delete all of
> > my data. Is this hbm2ddl? Is this possible to turn off as I don't want
> > to change the database schema at all? I want GRAILS to plug into my
> > existing schema and not to change it at all.
>
> go to grails-app/conf/ApplicationConfiguration.groovy and change the
> 'dbCreate' property to 'update'.
> The value maps to the hibernates hbm2ddl.auto property.
>
> > GRAILS looks fantastic, and if I can get over these hurdles, I can't
> > wait to start implementing it!
>
> Thanks.
>
> have fun
> Mittie
>
>
>
Reply | Threaded
Open this post in threaded view
|

RE: Newbie GRAILS-Hibernate Integration Problems

John Winn
In reply to this post by John Winn
Hi,
I am currently having some really good experiences with GRAILS! And now
I understand how to cope with packages of my hibernate domain objects,
all things are coming along well.

Only two minor gripes that I am now experiencing is that in the GET
string when it is passing parameters from the /list.gsp to the /show.gsp
the url looks like this: /show.gsp/1 which gives me a can't find error
on the page /1. Rather if I change it to show.gsp?id=1 in the URL bar,
it works! Perhaps that is a bug?

Also, the problem with keys and relations from the scaffold. I have two
objects in my hibernate model, one that is User and one that is
UserType, both in different tables and joined in a one to many
constraint etc.. Eg. Case is that user "JOHN" is a "ADMIN" while user
"BOB" is a "NORMAL" user and relevant security privileges are assigned
to each. What I am finding is that on the generated 'save' action in the
controller and on the view itself, it is sending back the string of the
toString, so hence I can't save a new User object without recoding the
save to find the relevant UserType object to assign to it before it goes
user.save(). Hope I have explained myself enough?

Cheers, John


-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf
Of Graeme Rocher
Sent: Sunday, March 19, 2006 12:03 AM
To: [hidden email]
Subject: Re: [grails-user] Newbie GRAILS-Hibernate Integration Problems

This is now fixed in CVS head. Thanks for the report

Graeme

On 3/18/06, John Winn <[hidden email]> wrote:
> Hi again,
>
> Thanks for the recommendation for the recipe saple, it helped a lot.
>
> However I have run both of them up (my app and the recipe sample) and
I seem to be getting this problem below.
>
> HTTP ERROR: 404
> /WEB-INF/grails-app/views//version/list.jsp
> RequestURI=/test-app/version/list
>
> This error is what I am getting when I try to execute list with
scaffolding turned on (an object in my database called "version", but in
the recipe sample just replace the word "version" with "sample").
>
> I checked in the tmp/war directory for the view folders that it
generates, and I notice that the full package name as to directoy name
(e.g. com.recipes.Recipe), yet the URI maps to "//version/list.jsp"
>
> Is there anyway to get around this?
>
> Thanks for your help, your previous help was excellent as I am now
seeing my domain models getting interacting fine with the current data,
but i want to test it using scaffolding first before I can finish this
web app.

>
>
>
>
>
>
> -----Original Message-----
> From: Dierk Koenig [mailto:[hidden email]]
> Sent: Fri 17/03/2006 7:42 PM
> To: [hidden email]
> Subject: RE: [grails-user] Newbie GRAILS-Hibernate Integration
Problems

>
> Hi,
>
> welcome to Grails.
>
> > Firstly, when I put hibernate into my app,
>
> what are you exactly doing at this point?
>
> You may want to look at the 'recipe' sample to see how exiting
> Java models and hibernate mappings can be used.
>
> > Secondly, the legacy database has a lot of data in it, and perhaps
as a
> > result of the above, when I start GRAILS app, it tends to delete all
of
> > my data. Is this hbm2ddl? Is this possible to turn off as I don't
want

> > to change the database schema at all? I want GRAILS to plug into my
> > existing schema and not to change it at all.
>
> go to grails-app/conf/ApplicationConfiguration.groovy and change the
> 'dbCreate' property to 'update'.
> The value maps to the hibernates hbm2ddl.auto property.
>
> > GRAILS looks fantastic, and if I can get over these hurdles, I can't
> > wait to start implementing it!
>
> Thanks.
>
> have fun
> Mittie
>
>
>
Reply | Threaded
Open this post in threaded view
|

RE: Newbie GRAILS-Hibernate Integration Problems

John Winn
In reply to this post by John Winn
Also one more,

The generated pages assume that I have an Id field in my objects, which
none of mine do. Is it possible for the generation to look at the
primary key in the domain objects (in my case a hibernate model) and use
them instead? I know this has probably already been discussed, but I
have to go through all the generated views and remove Id and map it to
my own simple/complex primary keys. (which I don't mind doing, it is
just a little inconvenient)

-----Original Message-----
From: John Winn [mailto:[hidden email]]
Sent: Tuesday, March 21, 2006 4:50 PM
To: [hidden email]; [hidden email]
Subject: RE: [grails-user] Newbie GRAILS-Hibernate Integration Problems

Hi,
I am currently having some really good experiences with GRAILS! And now
I understand how to cope with packages of my hibernate domain objects,
all things are coming along well.

Only two minor gripes that I am now experiencing is that in the GET
string when it is passing parameters from the /list.gsp to the /show.gsp
the url looks like this: /show.gsp/1 which gives me a can't find error
on the page /1. Rather if I change it to show.gsp?id=1 in the URL bar,
it works! Perhaps that is a bug?

Also, the problem with keys and relations from the scaffold. I have two
objects in my hibernate model, one that is User and one that is
UserType, both in different tables and joined in a one to many
constraint etc.. Eg. Case is that user "JOHN" is a "ADMIN" while user
"BOB" is a "NORMAL" user and relevant security privileges are assigned
to each. What I am finding is that on the generated 'save' action in the
controller and on the view itself, it is sending back the string of the
toString, so hence I can't save a new User object without recoding the
save to find the relevant UserType object to assign to it before it goes
user.save(). Hope I have explained myself enough?

Cheers, John


-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf
Of Graeme Rocher
Sent: Sunday, March 19, 2006 12:03 AM
To: [hidden email]
Subject: Re: [grails-user] Newbie GRAILS-Hibernate Integration Problems

This is now fixed in CVS head. Thanks for the report

Graeme

On 3/18/06, John Winn <[hidden email]> wrote:
> Hi again,
>
> Thanks for the recommendation for the recipe saple, it helped a lot.
>
> However I have run both of them up (my app and the recipe sample) and
I seem to be getting this problem below.
>
> HTTP ERROR: 404
> /WEB-INF/grails-app/views//version/list.jsp
> RequestURI=/test-app/version/list
>
> This error is what I am getting when I try to execute list with
scaffolding turned on (an object in my database called "version", but in
the recipe sample just replace the word "version" with "sample").
>
> I checked in the tmp/war directory for the view folders that it
generates, and I notice that the full package name as to directoy name
(e.g. com.recipes.Recipe), yet the URI maps to "//version/list.jsp"
>
> Is there anyway to get around this?
>
> Thanks for your help, your previous help was excellent as I am now
seeing my domain models getting interacting fine with the current data,
but i want to test it using scaffolding first before I can finish this
web app.

>
>
>
>
>
>
> -----Original Message-----
> From: Dierk Koenig [mailto:[hidden email]]
> Sent: Fri 17/03/2006 7:42 PM
> To: [hidden email]
> Subject: RE: [grails-user] Newbie GRAILS-Hibernate Integration
Problems

>
> Hi,
>
> welcome to Grails.
>
> > Firstly, when I put hibernate into my app,
>
> what are you exactly doing at this point?
>
> You may want to look at the 'recipe' sample to see how exiting
> Java models and hibernate mappings can be used.
>
> > Secondly, the legacy database has a lot of data in it, and perhaps
as a
> > result of the above, when I start GRAILS app, it tends to delete all
of
> > my data. Is this hbm2ddl? Is this possible to turn off as I don't
want

> > to change the database schema at all? I want GRAILS to plug into my
> > existing schema and not to change it at all.
>
> go to grails-app/conf/ApplicationConfiguration.groovy and change the
> 'dbCreate' property to 'update'.
> The value maps to the hibernates hbm2ddl.auto property.
>
> > GRAILS looks fantastic, and if I can get over these hurdles, I can't
> > wait to start implementing it!
>
> Thanks.
>
> have fun
> Mittie
>
>
>
Reply | Threaded
Open this post in threaded view
|

RE: Newbie GRAILS-Hibernate Integration Problems

John Winn
In reply to this post by John Winn
Hi,
I am also getting this error when going to some scaffolded pages? Is
this an out of date build file?

The <copy> type doesn't support the nested "copy" element.
     at
org.apache.tools.ant.IntrospectionHelper.throwNotSupported(Introspection
Helper.java:463)
     at
org.apache.tools.ant.IntrospectionHelper.getNestedCreator(IntrospectionH
elper.java:517)
     at
org.apache.tools.ant.IntrospectionHelper.getElementCreator(Introspection
Helper.java:583)
     at groovy.util.AntBuilder.createNestedObject(AntBuilder.java:375)
     at groovy.util.AntBuilder.createNode(AntBuilder.java:167)
     at
groovy.util.BuilderSupport.doInvokeMethod(BuilderSupport.java:120)
     at groovy.util.BuilderSupport.invokeMethod(BuilderSupport.java:86)
     at
org.codehaus.groovy.runtime.Invoker.invokeMethod(Invoker.java:161)
     at
org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.jav
a:104)
     at
org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethod(ScriptByt
ecodeAdapter.java:85)
     at
org.codehaus.groovy.grails.web.servlet.filter.GrailsResourceCopier.copyG
railsApp(script1143002472908.groovy:16)
     at
org.codehaus.groovy.grails.web.servlet.filter.GrailsReloadServletFilter.
doFilterInternal(GrailsReloadServletFilter.java:127)
     at
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequ
estFilter.java:76)
     at
org.mortbay.jetty.servlet.WebApplicationHandler$CachedChain.doFilter(Web
ApplicationHandler.java:821)
     at
org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationH
andler.java:471)
     at
org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:568)
     at org.mortbay.http.HttpContext.handle(HttpContext.java:1565)
     at
org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationCon
text.java:635)
     at org.mortbay.http.HttpContext.handle(HttpContext.java:1517)
     at org.mortbay.http.HttpServer.service(HttpServer.java:954)
     at org.mortbay.http.HttpConnection.service(HttpConnection.java:816)
     at
org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:983)
     at org.mortbay.http.HttpConnection.handle(HttpConnection.java:833)
     at
org.mortbay.http.SocketListener.handleConnection(SocketListener.java:244
)
     at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:357)
     at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:534)

-----Original Message-----
From: John Winn [mailto:[hidden email]]
Sent: Tuesday, March 21, 2006 4:54 PM
To: [hidden email]
Subject: RE: [grails-user] Newbie GRAILS-Hibernate Integration Problems

Also one more,

The generated pages assume that I have an Id field in my objects, which
none of mine do. Is it possible for the generation to look at the
primary key in the domain objects (in my case a hibernate model) and use
them instead? I know this has probably already been discussed, but I
have to go through all the generated views and remove Id and map it to
my own simple/complex primary keys. (which I don't mind doing, it is
just a little inconvenient)

-----Original Message-----
From: John Winn [mailto:[hidden email]]
Sent: Tuesday, March 21, 2006 4:50 PM
To: [hidden email]; [hidden email]
Subject: RE: [grails-user] Newbie GRAILS-Hibernate Integration Problems

Hi,
I am currently having some really good experiences with GRAILS! And now
I understand how to cope with packages of my hibernate domain objects,
all things are coming along well.

Only two minor gripes that I am now experiencing is that in the GET
string when it is passing parameters from the /list.gsp to the /show.gsp
the url looks like this: /show.gsp/1 which gives me a can't find error
on the page /1. Rather if I change it to show.gsp?id=1 in the URL bar,
it works! Perhaps that is a bug?

Also, the problem with keys and relations from the scaffold. I have two
objects in my hibernate model, one that is User and one that is
UserType, both in different tables and joined in a one to many
constraint etc.. Eg. Case is that user "JOHN" is a "ADMIN" while user
"BOB" is a "NORMAL" user and relevant security privileges are assigned
to each. What I am finding is that on the generated 'save' action in the
controller and on the view itself, it is sending back the string of the
toString, so hence I can't save a new User object without recoding the
save to find the relevant UserType object to assign to it before it goes
user.save(). Hope I have explained myself enough?

Cheers, John


-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf
Of Graeme Rocher
Sent: Sunday, March 19, 2006 12:03 AM
To: [hidden email]
Subject: Re: [grails-user] Newbie GRAILS-Hibernate Integration Problems

This is now fixed in CVS head. Thanks for the report

Graeme

On 3/18/06, John Winn <[hidden email]> wrote:
> Hi again,
>
> Thanks for the recommendation for the recipe saple, it helped a lot.
>
> However I have run both of them up (my app and the recipe sample) and
I seem to be getting this problem below.
>
> HTTP ERROR: 404
> /WEB-INF/grails-app/views//version/list.jsp
> RequestURI=/test-app/version/list
>
> This error is what I am getting when I try to execute list with
scaffolding turned on (an object in my database called "version", but in
the recipe sample just replace the word "version" with "sample").
>
> I checked in the tmp/war directory for the view folders that it
generates, and I notice that the full package name as to directoy name
(e.g. com.recipes.Recipe), yet the URI maps to "//version/list.jsp"
>
> Is there anyway to get around this?
>
> Thanks for your help, your previous help was excellent as I am now
seeing my domain models getting interacting fine with the current data,
but i want to test it using scaffolding first before I can finish this
web app.

>
>
>
>
>
>
> -----Original Message-----
> From: Dierk Koenig [mailto:[hidden email]]
> Sent: Fri 17/03/2006 7:42 PM
> To: [hidden email]
> Subject: RE: [grails-user] Newbie GRAILS-Hibernate Integration
Problems

>
> Hi,
>
> welcome to Grails.
>
> > Firstly, when I put hibernate into my app,
>
> what are you exactly doing at this point?
>
> You may want to look at the 'recipe' sample to see how exiting
> Java models and hibernate mappings can be used.
>
> > Secondly, the legacy database has a lot of data in it, and perhaps
as a
> > result of the above, when I start GRAILS app, it tends to delete all
of
> > my data. Is this hbm2ddl? Is this possible to turn off as I don't
want

> > to change the database schema at all? I want GRAILS to plug into my
> > existing schema and not to change it at all.
>
> go to grails-app/conf/ApplicationConfiguration.groovy and change the
> 'dbCreate' property to 'update'.
> The value maps to the hibernates hbm2ddl.auto property.
>
> > GRAILS looks fantastic, and if I can get over these hurdles, I can't
> > wait to start implementing it!
>
> Thanks.
>
> have fun
> Mittie
>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Newbie GRAILS-Hibernate Integration Problems

graemer
Hmm this is the file GrailsResourceCopier.groovy, but there doesn't
appear to be anything wrong with it that would cause this error...

What is happening is that a file has changed it is attempted to copy
the latest version into the tmp directory but failing..

Graeme

On 3/22/06, John Winn <[hidden email]> wrote:

> Hi,
> I am also getting this error when going to some scaffolded pages? Is
> this an out of date build file?
>
> The <copy> type doesn't support the nested "copy" element.
>      at
> org.apache.tools.ant.IntrospectionHelper.throwNotSupported(Introspection
> Helper.java:463)
>      at
> org.apache.tools.ant.IntrospectionHelper.getNestedCreator(IntrospectionH
> elper.java:517)
>      at
> org.apache.tools.ant.IntrospectionHelper.getElementCreator(Introspection
> Helper.java:583)
>      at groovy.util.AntBuilder.createNestedObject(AntBuilder.java:375)
>      at groovy.util.AntBuilder.createNode(AntBuilder.java:167)
>      at
> groovy.util.BuilderSupport.doInvokeMethod(BuilderSupport.java:120)
>      at groovy.util.BuilderSupport.invokeMethod(BuilderSupport.java:86)
>      at
> org.codehaus.groovy.runtime.Invoker.invokeMethod(Invoker.java:161)
>      at
> org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.jav
> a:104)
>      at
> org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethod(ScriptByt
> ecodeAdapter.java:85)
>      at
> org.codehaus.groovy.grails.web.servlet.filter.GrailsResourceCopier.copyG
> railsApp(script1143002472908.groovy:16)
>      at
> org.codehaus.groovy.grails.web.servlet.filter.GrailsReloadServletFilter.
> doFilterInternal(GrailsReloadServletFilter.java:127)
>      at
> org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequ
> estFilter.java:76)
>      at
> org.mortbay.jetty.servlet.WebApplicationHandler$CachedChain.doFilter(Web
> ApplicationHandler.java:821)
>      at
> org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationH
> andler.java:471)
>      at
> org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:568)
>      at org.mortbay.http.HttpContext.handle(HttpContext.java:1565)
>      at
> org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationCon
> text.java:635)
>      at org.mortbay.http.HttpContext.handle(HttpContext.java:1517)
>      at org.mortbay.http.HttpServer.service(HttpServer.java:954)
>      at org.mortbay.http.HttpConnection.service(HttpConnection.java:816)
>      at
> org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:983)
>      at org.mortbay.http.HttpConnection.handle(HttpConnection.java:833)
>      at
> org.mortbay.http.SocketListener.handleConnection(SocketListener.java:244
> )
>      at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:357)
>      at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:534)
>
> -----Original Message-----
> From: John Winn [mailto:[hidden email]]
> Sent: Tuesday, March 21, 2006 4:54 PM
> To: [hidden email]
> Subject: RE: [grails-user] Newbie GRAILS-Hibernate Integration Problems
>
> Also one more,
>
> The generated pages assume that I have an Id field in my objects, which
> none of mine do. Is it possible for the generation to look at the
> primary key in the domain objects (in my case a hibernate model) and use
> them instead? I know this has probably already been discussed, but I
> have to go through all the generated views and remove Id and map it to
> my own simple/complex primary keys. (which I don't mind doing, it is
> just a little inconvenient)
>
> -----Original Message-----
> From: John Winn [mailto:[hidden email]]
> Sent: Tuesday, March 21, 2006 4:50 PM
> To: [hidden email]; [hidden email]
> Subject: RE: [grails-user] Newbie GRAILS-Hibernate Integration Problems
>
> Hi,
> I am currently having some really good experiences with GRAILS! And now
> I understand how to cope with packages of my hibernate domain objects,
> all things are coming along well.
>
> Only two minor gripes that I am now experiencing is that in the GET
> string when it is passing parameters from the /list.gsp to the /show.gsp
> the url looks like this: /show.gsp/1 which gives me a can't find error
> on the page /1. Rather if I change it to show.gsp?id=1 in the URL bar,
> it works! Perhaps that is a bug?
>
> Also, the problem with keys and relations from the scaffold. I have two
> objects in my hibernate model, one that is User and one that is
> UserType, both in different tables and joined in a one to many
> constraint etc.. Eg. Case is that user "JOHN" is a "ADMIN" while user
> "BOB" is a "NORMAL" user and relevant security privileges are assigned
> to each. What I am finding is that on the generated 'save' action in the
> controller and on the view itself, it is sending back the string of the
> toString, so hence I can't save a new User object without recoding the
> save to find the relevant UserType object to assign to it before it goes
> user.save(). Hope I have explained myself enough?
>
> Cheers, John
>
>
> -----Original Message-----
> From: [hidden email] [mailto:[hidden email]] On Behalf
> Of Graeme Rocher
> Sent: Sunday, March 19, 2006 12:03 AM
> To: [hidden email]
> Subject: Re: [grails-user] Newbie GRAILS-Hibernate Integration Problems
>
> This is now fixed in CVS head. Thanks for the report
>
> Graeme
>
> On 3/18/06, John Winn <[hidden email]> wrote:
> > Hi again,
> >
> > Thanks for the recommendation for the recipe saple, it helped a lot.
> >
> > However I have run both of them up (my app and the recipe sample) and
> I seem to be getting this problem below.
> >
> > HTTP ERROR: 404
> > /WEB-INF/grails-app/views//version/list.jsp
> > RequestURI=/test-app/version/list
> >
> > This error is what I am getting when I try to execute list with
> scaffolding turned on (an object in my database called "version", but in
> the recipe sample just replace the word "version" with "sample").
> >
> > I checked in the tmp/war directory for the view folders that it
> generates, and I notice that the full package name as to directoy name
> (e.g. com.recipes.Recipe), yet the URI maps to "//version/list.jsp"
> >
> > Is there anyway to get around this?
> >
> > Thanks for your help, your previous help was excellent as I am now
> seeing my domain models getting interacting fine with the current data,
> but i want to test it using scaffolding first before I can finish this
> web app.
> >
> >
> >
> >
> >
> >
> > -----Original Message-----
> > From: Dierk Koenig [mailto:[hidden email]]
> > Sent: Fri 17/03/2006 7:42 PM
> > To: [hidden email]
> > Subject: RE: [grails-user] Newbie GRAILS-Hibernate Integration
> Problems
> >
> > Hi,
> >
> > welcome to Grails.
> >
> > > Firstly, when I put hibernate into my app,
> >
> > what are you exactly doing at this point?
> >
> > You may want to look at the 'recipe' sample to see how exiting
> > Java models and hibernate mappings can be used.
> >
> > > Secondly, the legacy database has a lot of data in it, and perhaps
> as a
> > > result of the above, when I start GRAILS app, it tends to delete all
> of
> > > my data. Is this hbm2ddl? Is this possible to turn off as I don't
> want
> > > to change the database schema at all? I want GRAILS to plug into my
> > > existing schema and not to change it at all.
> >
> > go to grails-app/conf/ApplicationConfiguration.groovy and change the
> > 'dbCreate' property to 'update'.
> > The value maps to the hibernates hbm2ddl.auto property.
> >
> > > GRAILS looks fantastic, and if I can get over these hurdles, I can't
> > > wait to start implementing it!
> >
> > Thanks.
> >
> > have fun
> > Mittie
> >
> >
> >
>