grails

File not found exception while reading .sql file present in grails-app/conf/sql

Hi, I have an sql query in my controller action (select * from table....where.....et al). This query is fired when the user submits a page. It is a 50 lines code that takes in 3 parameters. For eg: select * from employee where empDate='params.empDt' and empNum=params.empNum order by params.sort asc. In the above case the query tak...

Best grails implementation for tracking number of views (or unique visitors) for a web page ?

I need to implement a very popular feature : displaying the number of views for a profile page. For instance, my profile page in StackOverflow will display how many persons have viewed my profile (just under my reputation score). I suppose that the algorithm is based on some cookies and/or visitor IP addresses. Is there a simple way (a...

grails: how to bind data to GroovyPagesTemplateEngine instance?

Hi, I tried to bind data to a template created using GroovyPagesTemplateEngine, but cannot. Here is what I can as far I can go. Could some one help? Thanks! import org.codehaus.groovy.grails.web.pages.GroovyPagesTemplateEngine import org.springframework.core.io.FileSystemResource File myfile = new File("c:\\myTools\\mydata.gsp") def ...

Grails: How to make a SAVE button inside the same table and make it work??

Hello there: I have the create inside the table/list that Grails provides. Here is a pictures of what I have As you can see, I create everything on the first row of my table, and then from the 2nd row and on is the actual list. In the last column of the 2nd row, you can see I have the UPDATE button and a delete button. The delete ...

What are the best options for hosting a Grails application?

I'm looking for the best hosting option for a Grails application, my requirements are: Low number of requests and storage (to start with likely only hundreds of requests per day) Ease of deployment and configuration (I want to concentrate on development and not setup and admin tasks) Low cost I've investigated the following: Amazon...

Guidance for retrieving number of page views using Google Analytics API

An answer of the question Best grails implementation for tracking number of views (or unique visitors) for a web page ? was to use Google Analytics API for tracking and displaying the number of page views for some particular page on my website. I liked the idea and had a look of the Google Analytics API but, at first view, it seems to ...

Grails Secure Login Design Questions along with Library & DB Choice

Hello, Am planning on building user administration module using Grails and the Spring Security Core plug-in for Grails. Also, am considering using MongoDB for the database system. Question(s): (1) What trade offs and benefits will my app gain by choosing MongoDB over MySQL or HSQLDB? (2) Is it super easy to way to implement (meaning...

Grails + Acegi: How to handle password renewal ? Logged vs not logged user

Hi, I'm writing a module to force a user whose password has expired to renew its password. This app uses the acegi security plugin. After the expired credentials are detected, the user is redirected to a "insert a new password" page. However, when the form is submitted, the auth action is executed, instead of the desired one (renewPass...

Custom Insert and Update methods defeated by automatic Save

I am porting a Grails application from Oracle to MySQL database. The original Oracle version is a legacy database which uses a few complex Views leveraging Oracle's INSTEAD OF INSERT OR UPDATE feature which MySQL doesn't have. As a workaround I have implement Insert and Update methods on the Domain classes which point to these kinds of V...

delete all items from sorted set in grails

I have a grails project with a class that I can delete no problem when doing it "manually" from the controller. I use the following code. def delete = { def projectInstance = Project.get( params.id ) def employee = projectInstance.employee def projectarray = new ArrayList<Project>(); projectarray += employee.getProjects(...

Grails "render as XML" throws java.lang.NullPointerException - what am I doing wrong?

I use the following Grails code to render a collection of SomeClass-objects as XML: def someObjects = SomeClass.findAllByFoo(foo) if (someObjects) { render(contentType:"text/xml", text:someObjects as XML) } This works as expected most of the time. However, sometimes and depending on the content of someObjects the code fails with the...

grails events and cascaded saves

Hi, do grails events like beforeInsert or afterInsert get invoked on cascaded saves? I wrote an integration test and i find that the events are getting invoked on an explict save and not on cacaded saves. Is there any way i can invoke the event on a cascaded save? ...

Grails: How does that the UPDATE function work?

I got rid of the original UPDATE gsp Grails offers. I put it in the first row of my list.gsp table and change all the values of the table to g:textfield so they can be edited without going to the save.gsp But now I'm trying to make it work, and I can't. I added a update button in the last column of the row, of every row. When I chang...

Grails: Using jQuery for clear form not working

Hello: I am using Grails and the first part I have is a search field. I am using this to create the CLEAR button, but it is not working: $("#clear").click(function() { $(':input','#container') .not(':button, :submit, :reset, :hidden') .val('') .removeAttr('checked') .removeAttr('selected'); $("#...

is there an "inverse" cascade in grails like there is in hibernate?

I have the following sql database that grails set up for me automatically. see picture for diagram http://yfrog.com/ngskillsdbj Whenever I try to delete all projects from an employee, I am getting a cascade re-save exception on the role_skill. Is that because of the way this is set up where role_skill is keyed into skill and role? I s...

Grails - How to - Unit test Service that uses params from controller

Hi, I'm trying to unit test a service method that takes as parameters a date and the params LinkedHashMap from the controller. The setup is as follows: def save = {CustomCommandObject erc -> ... if (erc.conditionProperty != null) { def result = myService.ServiceMethod(someDate, params) ... } .... redirect(co...

webflow in grails application

how can i redirect to the same state more than one time using web flow ex: on('submit'){ def destinationInstance = Destination.get(params.destination) def destinationGroupsInstance = DestinationGroup.get(params.destinationGroups) def h = destinationInstance.addToDestinationGroups(destinationGroupsInstance) }.to('flowList') ...

How to add constraints on inherited properties in a grails domain sub-class

Here's what I'd like to do: class A { String string static constraints = { string(maxSize:100) } } class B extends A { static constraints = { string(url:true) } } So class A should have some constraints and B should have the same plus additional constraints on the same property. I couldn't get that to work though a...

How to exclude certain plugins from war in grails 1.3.5

Hi I'm seeking how to exclude plugins for specific environments. According to GRAILS documentation, starting with 1.3.5 it's now possible to disable a bunch of plugins. For example, I add the jetty plugin for local testing, but don't need it for deployment. I try to use the following in Config.groovy: envname { . . . pl...

grails limited table creation

Hello, I'd like to use the Grails feature for creating/updating database tables on a limited basis. Specifically, I'd like Grails to manage some tables, but not all. Is there a way to limit the tables managed by Grails or is it an all or nothing proposition? Thanks, Steve ...