grails

Modify Id generation for a Grails Plugin

I am using a plugin for Grails - the Amazon S3 plugin - and the domain object provided by the plugin doesn't specify the Id Generator. I am using Postgresql and require the id genrator to be identity. I could copy the plugin in my plugins directory and mess with the domain object provided but that doesn't sound like a clean approach.Cou...

How do I upgrade the Grails version for an existing application?

I have an example Grails application (from Grails in Action) that was created a while ago under version 1.1.1 on a different PC. I am now loading Grails 1.2.0 and want to revisit the app. However, when I try to run it I get this message: Application expects grails version [1.1.1], but GRAILS_HOME is version [1.2.0] - use the correct...

Grails regenerate Eclipse project

I just upgrade Grails to 1.2.0. How can get Grails to regenerate the Eclipse .classpath file? It's currently pointing to the old Grails' JARs. ...

Popup message window in grails?

I have a Grails application with a form in it. Once the user has entered the data and submitted it, and it's been validated etc.. I need a message to popup in a little window to give the user some feedback - it needs to popup, rather than be displayed on the page. Can anyone advise me on the best way to do this? ...

"org.json.JSONArray implements Serializable": What's the best option to achieve this?

I am using Grails Webflow, what ever object I pass to a view, it must be Serialized. My domain models "implement Serializable", so they work. The problem is when I get a response from a WebService. It is of the org.json.JSONArray class. I just want to pass the whole Array over to the view yet it doesn't implement Serializable, so it fa...

Grails shell not seeing domain objects

Hi, I'm a grails newbie (and a groovy newbie), and I'm working through some grails tutorials. As a new user, the grails shell is a really useful little tool for me, but I can't figure out how to make it see my classes and objects. Here's what I'm trying: % grails create-app test % cd test % grails create-domain-class com.test.TestObj ...

grails ui dialog

I am trying to do something which I would've thought was very simple, but it's causing me a huge headache. I am using Grails ui plugin to get a dialog box. I have a number of instances - some where dialog boxes need to appear when a button is clicked. This I have got working. But I also need to have some that appear when the page is lo...

Grails GoogleAppEngine no metadata problem

Hi I am trying to run grails on google app engine using JDO, but I got this: org.codehaus.groovy.runtime.InvokerInvocationException: javax.jdo.JDOFatalUserException: No meta data for Book. Perhaps you need to run the enhancer on this class? NestedThrowables: org.datanucleus.exceptions.NucleusUserException: No meta data for Book. Perh...

Where should I put javascript libraries in a Grails app?

I have a couple of Javascript libraries of my own that do some nice prettyfying of my HTML pages and I want to include them in my gsp pages, particularly the landing page of my app. I have tried putting them in views folder and web-app/js and $APP_HOME/scripts but when I load my index.gsp the scripts don't show up. I have also tried a ...

Grails "not-null property references a null or transient value" exception on web flow

Hi, I'm getting "org.springframework.dao.DataIntegrityViolationException: not-null property references a null or transient value: A.b" exception on web flow in grails 1.1.2. there is class B { ... static belongsTo = [a:A] ... } and class A { ... static hasMany = [b:B] ... } Does anyone know what is wrong? Thank...

In Grails GSP, what is the equivalent to Spring MVC's <input name="entity.list[0].field">?

I'm coming from a Spring MVC background on a new Grails app. I have an object that contains a list of dependent objects. On the create and edit screen, I want to edit that object and its list of objects at the same time. In Spring MVC, you could use special names to bind the form fields to items in a list. Example: Entity { String n...

Why does registering a new user using the ACEGI plugin for GRAILS give a "Default Role not found." error.

Perhaps put a different way, how do I set up a default security role for newly registered users in Grails using teh ACEGI plug-in? I have followed the acegi/grails tutorial here and am using controller annotations - although I haven't secured anything yet. I added a second role called WEB_USER and have successfully added a User to that...

Acegi User Class constraints under groovy

Hi I have an Groovy appilcation using Acegi Spring Security. My User Class looks as follows: class User { static constraint = { email(blank:true, nullable:true) description(blank:false, nullable:false) username(blank: false, unique: true) userRealName(blank: false) company(nullable:true, blank:true) authorit...

Grails WebFlow with Ajax

I am trying to transition to next state of a WebFlow using Ajax requests. But it stays in the same state and returns the GSP as response for that state while I am expecting the GSP for the next state. Following is the WebFlow code: def gettingStartedAjaxFlow = { flow1 { on("next") { ...

Get most popular items in Grails

My simplified domain model in grails is like this: Article { Integer totalViews static hasMany = [ ratings: Rating ] } Rating { Integer value // 1 to 5 User user } I am trying to find the 5 most popular articles based on totalViews and ratings, say 25% weightage on views and 75% weightage on ratings. How ...

Grails Many to Many Association Querying

I have a many to many relationship. class Post { String title static hasMany = [tags:Tag] } class Tag { static hasMany = [posts:Post] } I would like to get a list of posts for a tag that have some other criteria (like a sort order, partial title match, etc). Do I have to use the grails criteria to achieve this? Or is ther...

Is Grails (now) worth it?

I know this is a duplicate, however, the Grails world has moved on considerably since that question was asked more than a year ago, as has the IDE support in Eclipse, so please don't just blindly close it. I thought the answer was yes and have embarked on a new project with Grails 1.2.0 and have flirted with the Groovy/Grails bits of ...

IllegalAccessException with grails timeZoneSelect tag on google app engine/java

Hi, Has anyone used the grails timeZoneSelect tag on GAE/J ? I've come across the error below on app engine. I know reflection is not allowed, but the line in error seems to be calling a straightforward public function (inDaylightTime)? Does anyone know how to workaround this (short of a hardcoded list of time zones)? thanks Uncaugh...

Basic Grails question: How does the following Grails code define personInstance?

This is the GSP code generated by Grails for the view of the edit action for a Person domain object which is part of my model, and also happens to be the primary class for authentication by the ACEGI security plug-in. I have snipped out a bunch of properties to keep it short. The file resides in the standard location, grails-app/views/...

Stopping Grails from generating certain methods in a controller?

In Spring Roo if I don't want a specific method to automatically be generated I can remove an annotation. Is there a way to do this in Grails? For example I would like the list and create methods of a controller to automatically be updated with any changes in the domain model when I do a generate-all, but would like to use custom code fo...