grails

Ruby on Rails vs Grails vs. Spring ROO vs. Spring App

Hi, I'm planning on writing a simple web application that will be used by lots of users (as complicated as a simple bookmarking app) and I'm trying to decide which framework/language to use. I'm very experienced with Spring/Hibernate and Java in general but new to both Grails and RoR (and Spring ROO). The only reason I'm considering R...

How to get entries from the second level query cache ?

In my grails application, I want to display all the current entries of the second-level cache from all regions. My code is as following : def getCacheStats() { StatisticsImpl stats = sessionFactory.statistics for (regionName in stats.secondLevelCacheRegionNames) { log.debug stats.getSecondLevelCacheStatistics(regionName).entrie...

Size of assosiation in Hibernate criteria.

Hello guys. I've faced with a problem when querying with Hibernate Criteria in Grails. Take a look: def visitors = Client.withCriteria{ visits{ use ( TimeCategory ) {between('date',date,date+1.month-1)} } sizeGe("visits",params.from) sizeLe("visits",params.to) fetchMode("v...

Unit testing a controller method?

I have a controller method like such: def search = { def query = params.query ... render results as JSON } How do I unit test this? Specifically, how do I call search to set params.query, and how do I test the results of the method render? Is there a way to mock the render method, perhaps? ...

How to render or include files/data in bootstrap.groovy?

I want to use some parts of code in different area of bootstrap.groovy. How do I "include" these parts and reuse it? def init = { environments { production { include("bla.groovy) include("blaFoo.groovy) } test { include("blaFoo.groovy) } development { ...

Issue with class design to model user preferences for different classes

Hi all, I'm not sure how to design a couple of classes in my app. Basically that's a situation: each user can have many preferences each preference can be referred to an object of different classes (e.g. album, film, book etc) the preference is expressed as a set of values (e.g. score, etc). The problem is that many users can h...

update on acegi roles for user?

If a loggedin user gets a new role, what does he has to do to get all permissions based on this role? logout and login again does not work reassign the roles with an admin-account works Do i have to delete all roles given to this user, and reassign them? Role model is hierarchical. ROLE_POWERUSER > ROLE_USER ...

Best way to model map values in Grails?

Hi guys, I have to implement map values in my Grails app. I have a class that can contain 0..N OsmTags, and the key is unique. In Java I would model this with a Map in each object, but I don't know how to map classes in Grails. So I defined this class: class OsmTag { /** OSM tag name, e.g. natural */ String key /** OSM tag...

Grails / GORM, Disable First-level Cache

Suppose I have the following Domain class mapping to a legacy table, utilizing read-only second-level cache, and having a transient field: class DomainObject { static def transients = ['userId'] Long id Long userId static mapping = { cache usage: 'read-only' table 'SOME_TABLE' } } I have a problem, references to DomainObjec...

Custom Grails Environments?

I have been developing several Grails applications over the past couple of years. I am increasingly finding that the three grails environments (dev, test, prod) aren't enough to satisfy my needs. The more "enterprisey" your application gets, the more environments you tend to have. I tend to use 6 environments for my development cycle......

Speeding Up Grails Dependency Resolution

We're currently working on an app with a relative large number of external dependencies, as we're integrating with a fairly complex existing system. The dependencies are working just fine, however, it still takes several minutes to resolve dependencies regardless of whether or not the dependencies are already in the Ivy cache. If the ca...

How to use setted variables in Config.Groovy and concatenate it

I want to reuse vars setted once again later in Config.groovy Example: static.serverURL = "http://static.foo.com" static.path = "" bar.default.picUrl=static.serverURL+static.path+"/images/bar.png" but that gives me a groovy.util.ConfigObject.plus() is applicable for argument types: (java.lang.String) changing it to bar.default.p...

How to extend per environment configuration in grails

It seems that only grails.serverURL and grails.path are recognized as per environment configrautions. bla and foo are ignored and could not be used in application Anyone could solves this and provide a way to get bla and foo configured per environment? environments { production { grails.serverURL = "http://alpha.foo.de" ...

GORM ID generation and belongsTo association ?

I have two domains : class CodeSetDetail { String id String codeSummaryId static hasMany = [codes:CodeSummary] static constraints = { id(unique:true,blank:false) } static mapping = { version false id column:'code_set_detail_id', generator: 'assigned' } } and : class CodeSummary { String i...

Grails Testing hickups

I have two testing questions. Both are probably easily answered. The first is that I wrote this unit test in Grails: void testCount() { mockDomain(UserAccount) new UserAccount(firstName: "Ken").save() new UserAccount(firstName: "Bob").save() new UserAccount(firstName: "Dave").save() assertEquals(3, UserAccount.coun...

grails date from params in controller

y is it so hard to extract the date from the view via the params in a grails controller? i don't want to extract the date by hand like this: instance.dateX = parseDate(params["dateX_value"])//parseDate is from my helper class i just want to use instance.properties = params you know :) in the model the type is java.util.Date and in th...

Is there a lightweight Groovy web framework other than Grails?

Grails is great. Yet, sometimes, we just need a quick, lightweight web framework. Is there such a thing out there? ...

Grails - How to format a value in a textfield into comma style such that it can be easily read?

Hi there, I want to allow users enter numbers in textfield and once the textbox loses focus. The number is formatted with commas. e.g. User enters 100000 textfield looses focus value displayed: 100,000 How can I achieve this in Grails. I have looked at <g:formatNumber number="${myNumber}" format="\\$###,##0" /> But it doesnt solve...

What is the best way to test using grails using IDEA?

I am seriously having a very non-pleasant time testing using Grails. I will describe my experience, and I'd like to know if there's a better way. The first problem I have with testing is that Grails doesn't give immediate feedback to the developer when .save() fails inside of an integration test. So let's say you have a domain class wi...

Grails Runtime Exception with Audit Logging Plugin

I've deployed my app to tomcat running on EC2 via Cloud Foundry. The application uses the Grails Audit Logging Plugin I'm getting the following runtime error: Error 500: Executing action [save] of controller [com.questern.aoms.CompanyController] caused exception: groovy.lang.MissingPropertyException: No such property: errors for clas...