grails

Grails json string converter with Dates

Hi, I'm POSTing json data to a Grails controller which I then parse using JSON.parse. It all works fine except for date fields. I don't believe there is an explicit syntax in json to represent a Date but I've tried a number of formats with no luck. Can anyone tell me what format I should use so that the grails JSON parser can create a Da...

Need help about grails domain class design.

I need to create grails domain class like this(see image),but I don't know how to do. Can someone please give me the solution,please? Image : http://www.uppicweb.com/x/i/ib/6demo.jpg ...

howto encrypt passwords in configuration files, grails [and java]

I am looking for a step-by-step how to on securing passwords put in configuration files, in grails. This means securing passwords in Config.groovy and DataSource.groovy. There are a lot of google results that contains bits and pieces of the answer, but no concise guides on how to do this. Can someone please point me in the right direc...

How to get Grails to use a sessionFactory defined in resources.xml?

Hi, I want Grails to use a sessionFactory bean defined in resources.xml? By default, you use DataSource.groovy to define the necessary properties and Grails is automatically creating a sessionFactory called "sessionFactory". I need to define the sessionFactory in resources.xml because I need to use some legacy beans. Both, Grails artef...

How do I sort a linked list in hql?

Same question as this, only I'd like to do it in Hibernate (using grails if that matters). So the domain class looks like this class LinkedElement { LinkedElement precedingElement String someData } and I'd like to query all elements in their linked order (where the first LinkedElement has null as the precedingElement). Is this po...

Using Metro, adding a MTOMFeature to client side causes a MIMEParsingException, why?

We have an MTOM-enabled web service that is published with Grails and the Metro 1.0.2 plugin: @MTOM @WebService(targetNamespace="http://com.domain") class TestService { @WebMethod int uploadFile(@XmlMimeType("application/octet-stream")DataHandler data) { data.dataSource.inputStream.eachLine { println "readi...

grails tag library question

Hello, I am using Grails in an application that allows the inline editing of data in a data grid. There are certain key fields that may be defined and should not be editable. Here is some example code from the tag lib that I am using case "dropdown": out << "<select id='"+prefix + id+"' name='" + fieldData.code + "'>" ...

best way to configure Springsource Tool Suit (STS, eclipse) to work with grails

I am looking to the best way to configure eclipse or STS to work right with Grails. I am working with the 2.3.2 version. I have tried to set classpath the right way installing this plugin: http://grails.org/plugin/eclipse-scripts Also this awnser. But I am having several issues: Autocomplete doesn't work, it shows this message when ...

Grails - IntelliJIdea9 Strange problem with packages

I'm having some trouble on a checked out project here at work. I have a class called GridBuilder, which is located in a package called com.ent.proj.utils.grid package com.ent.proj.utils.grid import grails.orm.HibernateCriteriaBuilder import org.hibernate.criterion.Criterion import org.hibernate.Criteria class GridBuilder { } The w...

Grails problem persisting data in join tables for many-to-many relationships

I am having problems persisting domain objects where I have a many-to-many relationship with a join table class A{ String name static hasMany = [bs:B] } class B{ String surname static belongsTo=A static hasMany=[as:A] } A a = new A(name:'Test') B b = new B(surname:'user') a.addToBs(b) a.save(flush:true) Then what I would expec...

Documenting in grails

I want to generate something like http://grails.org/doc/latest/ for my grails project. I have tried grails doc, but It doesn't organize the project in Taglibs, etc. I want something to fetch easily the taglib for a given namespace. Also to see more clearly the global state of documentation of the project. Do you know if exists a plug...

Getting grails application version from within the app

I'd like to display the application version in the footer of my app. Is there a way to get the value of the app.version variable in the application.properties file at runtime? ...

When does grails.config.locations get processed in Grails?

I am using grails 1.2.1 and would like to specify external configuration (properties) files for the war file for my application. I understand from documentation that the proper way to do this is to specify the grails.config.locations list in the Config.groovy file. When I do that, however, the properties that should be set are not av...

has one relationships and deletion in grails

How should i delete the child object in a hasOne relationship in grails for eg: class Face { static hasOne = [nose: Nose] } class Nose { Face face static belongsTo= Face } i tried deleting the child object by two ways 1. face.nose.delete() 2. nose.delete() I always get the same exception Deleted object resaved by cascade in both...

Grails 1.3.3: controller.redirectArgs.action not populated

Does anyone knows what happened to controller.redirectArgs.action in the latest version of Grails (1.3.3)? It used to work properly but now I get NPE when I use it. class FooController { def someRedirect = { redirect(action:"bar") } } class FooControllerTests extends grails.test.ControllerUnitTestCase { void testSom...

Grails: Declarative Transactions

class ExtHotelApiService extends HotelApiService { static scope = "singleton" static transactional = true def save(params) { params.hotels.each{ht-> try{ transactionalSave(ht) } catch(Exception e) { /* exceptions handling */ } } } @Transactional(readOnly = false, propagation = Propagation.REQUIRES_NEW, rollBack...

getting Principal during Grails Spring Security authentication

I'm wrapping up an implementation of Spring Security in Grails. This is my first implementation on Spring Security- previously I used Acegi. Here's the problem I'm having. In Acegi, I was able to retrieve the authenticated user in the onInteractiveAuthenticationSuccessEvent() callback by accessing the SecurityContextHolder, getting th...

Change Configurations after War Build

I have two configurations I need to change after building a prod war with grails 1.3.2. I know the project can be setup in ways to do this externally in the first place, but that's not an option at this moment. 1) Need to change environments.production.hibernate.default_schema defined in DataSource.groovy 2) Need to change environment...

Problem implementing declarative transactions

Hi I want to implement transaction control at the function level. What i want is something like this. class MyService{ static transactional = false @Transactional(readOnly = false, propagation = Propagation.REQUIRES_NEW) public def saveCountry(){ Country co = new Country(name:'mycountry') co.save() createState...

Is it possible to add Grails MVC classes at deployment time?

I'm writing a Grails app which I'd like 3rd parties to augment at runtime. Ideally they would be able to add a JAR/WAR to the webapp directory which contains new domain, controller and service classes, new views, and other content. Is there a simple way to do this within grails? Would it be simplest to create a startup script which co...