Help needed upgrading Grails 1.0.3. app to Grails 1.3.1.

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

Help needed upgrading Grails 1.0.3. app to Grails 1.3.1.

jondo_w
I'm having a problem I can't yet figure out upgrading a 1.0.3. app to 1.3.1. I've already made the following changes to the app

- I'm using the new plugin approach
- modified Config.groovy for logging changes
- moved controller, domain, service and taglib classes to package structure

The app now starts up fine, but it throws an exception on a fairly straightforward HQL query:

        def deletedAccount = Account.findByName("Deleted")
        def users = User.executeQuery("select a from User a where a.account = ?", [deletedAccount])

This throws the following exception:

        org.hibernate.QueryException: Expected positional parameter count: 1, actual parameters: [Deleted] [select a from User a where a.account = ?]

This seems to be related to a really old bug in Hibernate but I'm running another app on 1.2 and have never had an issue with queries of this nature. Also, other queries aren't working because they're not returning data for use cases where previously they would have. So the query is returning an empty resultset when it shouldn't be. Teething pains I'm sure, but I don't know where next to look. Does anybody have any suggestions of where I should look? I'm stuck at the moment.

Just to add I've done the standard things of 'grails clean', looking for old JAR's in custom plugin libs etc but all to no avail.

Thanks,
Darryl Pentz

Reply | Threaded
Open this post in threaded view
|

FIXED: Help needed upgrading Grails 1.0.3. app to Grails 1.3.1.

jondo_w
That Account class that user has a reference to also includes a reference to a User who is the 'subscriber' to the Account. I had omitted to indicate, with the new Grails 1.1+ (I think) syntax, the hasOne aspect of that 'subscriber' field, which causes a glitch in the GORM matrix, it seems.

Adding the hasOne discriminator to the field solved my problem.

- DP


From: Darryl Pentz <[hidden email]>
To: [hidden email]
Sent: Sun, June 13, 2010 11:15:44 AM
Subject: [grails-user] Help needed upgrading Grails 1.0.3. app to Grails 1.3.1.

I'm having a problem I can't yet figure out upgrading a 1.0.3. app to 1.3.1. I've already made the following changes to the app

- I'm using the new plugin approach
- modified Config.groovy for logging changes
- moved controller, domain, service and taglib classes to package structure

The app now starts up fine, but it throws an exception on a fairly straightforward HQL query:

        def deletedAccount = Account.findByName("Deleted")
        def users = User.executeQuery("select a from User a where a.account = ?", [deletedAccount])

This throws the following exception:

        org.hibernate.QueryException: Expected positional parameter count: 1, actual parameters: [Deleted] [select a from User a where a.account = ?]

This seems to be related to a really old bug in Hibernate but I'm running another app on 1.2 and have never had an issue with queries of this nature. Also, other queries aren't working because they're not returning data for use cases where previously they would have. So the query is returning an empty resultset when it shouldn't be. Teething pains I'm sure, but I don't know where next to look. Does anybody have any suggestions of where I should look? I'm stuck at the moment.

Just to add I've done the standard things of 'grails clean', looking for old JAR's in custom plugin libs etc but all to no avail.

Thanks,
Darryl Pentz


Reply | Threaded
Open this post in threaded view
|

Re: FIXED: Help needed upgrading Grails 1.0.3. app to Grails 1.3.1.

pledbrook
> That Account class that user has a reference to also includes a reference to
> a User who is the 'subscriber' to the Account. I had omitted to indicate,
> with the new Grails 1.1+ (I think) syntax, the hasOne aspect of that
> 'subscriber' field, which causes a glitch in the GORM matrix, it seems.

Just a small correction: hasOne arrived with Grails 1.2.

> Adding the hasOne discriminator to the field solved my problem.

Glad to hear!

Peter

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

    http://xircles.codehaus.org/manage_email