grails

Many-to-Many of members of the same domain class

In Grails, I like to have a many-to-many relation among entries of the same domain class Person. Relations will link to different persons the "leftPerson" and the "rightPerson" since the "Parent-child" and "Employer-Employee" relations will discriminate the position of each link. That I would like to have is something like the following...

Grails: Debugging save() or validate()

I'm somewhat new to Grails. As I create or update domain object and fire save() or validate() on an object, if the method fails, the system does not seem throw an exception. I dont see any way to examine what exactly is failing. A typical snippet: if (domainInstance.validate()) { flash.message = "Succesfully updated domain object" } ...

Does grails / hibernate store Dates with miliseconds in PostgreSQL?

I'm currently using grails with classes storing java.util.Date fields als DATETIME. However I need the precision / miliseconds to be stored as well which I think is not possible with MySQL. If I switch to PostgreSQL, will it store my Dates with milisecond precision (or is it easy to configure it this way)? ...

Grails password change: Allow only "new" passwords.

Hi, I need to improve security in a website built on grails. The requirement is that when a user changes its password, it shouldn't be able to choose from any of the previous N passwords. Does anyone know a module for this? Should I roll my own? Any thoughts / tips will be appreciated. Thanks in advance ...

how to display grails error from bootstrap

Hi, I just found annoying bug from my bootstrap.groovy. If I did a mistake for example, like undeclared variable, the apps keep running and then when I tried to access the apps from web it will display HTTP Status 404 - type Status report message description The requested resource () is not available. Apache Tomc...

How do I associate all logs with their request in grails?

In our grails application we're logging a lot, but need a mechanism to associate all of those messages with the request/response being processed. It has proven easy enough to generate a request UUID, but now I'd like that id appended to each log message generated within a request context without passing that id within each log message. ...

Grails filterPane plugin to fit page layout

I would like to have the filterPane to be inserted in my own div in order to fit my page layout. Basically I want to get rid of the default pop-up behavior and harmonize filterPane with the other elements of the application. this is my gsp <div class="filter"> <p> <filterpane:isFiltered> <f...

How to I bind a Hibernate Session to a thread in Grails?

I'm writing a multi-threaded application in Grails and the additional threads need access to GORM/Hibernate. When they try to access GORM I get the error "org.hibernate.HibernateException: No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here". OK fair enough, can someone guide me ...

Grails withCriteria exception when using One-to-many relationship

I have 2 domains : class JobProcess { static constraints = { scriptUser(blank:false) scriptType() scriptName() scriptPath() scriptArgs(size:0..1000,nullable:true) scriptDateCreated(nullable:true) scriptDateStarted(nullable:true) scriptDateFinished(nullable:true) script...

Can domain classes be configured to insert a new record instead of updating when saved?

When I change a domain object, rather than updating the database record, I'd like to archive the old record record and create a new one. I'd like to force GORM to do this automatically. For example, if I had this domain class: class User { String username String email Boolean active } then I'd like user.email = email us...

How to manage object revisions in Grails?

I need to implement a revision system for articles in my grails web app. After searching grails forum, stackoverflow, grails plugins and googling internet, I have ended up with 3 options: Option 1 - Using the grails Envers plugin (see http://code.google.com/p/grails-envers-plugin/). Has anyone used it successfully? Or using Envers with...

Grails: can parallet MVC be implemented?

I am new to grails, just read the first half of Grails in Action. Grails looks very promising and I am trying to use it for my next project. I'll have a tree structure of data: business -> campaign -> promotion; there will be many businesses, each of which can be viewed/edited at the same time. The view will look like a tabbed browser, w...

Generics with Grails

What I am trying to do is define a list which asks for a specific type (List<Integer>). During the initialization of the class I put in a list of String I expect it to throw some runtime casting error. But it doesn't - it runs fine. This is probably grails 101 stuff im sure but could someone explain why this works and also how I would ...

[GRAILS] using different formats for BigDecimal in bindData

Hi, i have a class class Foo { BigInteger phase BigDecimal amount BigDecimal percent } and want to use bindData to map some user input. The user enters data in different formats for amount and percent i.e. : amount : 100.000,00 percent : 75,50% bindData parses this to amount = 100000 (in GERMAN...

How to intercept all Hibernate sessions when they're created (Spring / Grails environment)

Is there a way of intercepting all new Hibernate sessions when they're created? I need to access each Session instance to enable a Hibernate filter with a parameter. The only solution I've gotten working has involved wrapping the SessionFactory, but this involved a lot of semi nasty hacks as well as it required me to implement around 6...

How do I get "happy" names using Amazon S3 plugin for Grails (via Jets3t)

References: http://www.grails.org/plugin/amazon-s3 http://svn.codehaus.org/grails-plugins/grails-amazon-s3/trunk/grails-app/services/org/grails/s3/S3AssetService.groovy http://svn.codehaus.org/grails-plugins/grails-amazon-s3/trunk/grails-app/domain/org/grails/s3/S3Asset.groovy By "happy" names, I mean the real name of the file I'm up...

How to make sure that Tomcat6 reads CATALINA_OPTS on Windows?

Hi all, I have a Tomcat6 running on a Windows2003 machine. I deployed 2 Grails apps on this server and I soon noticed that everything was crashing sometime after the deploy with a classic PermGen error. java.lang.OutOfMemoryError: PermGen space java.lang.ClassLoader.defineClass1(Native Method) java.lang.ClassLoader.defineClassCond(Cla...

How to use command to shutdown grails run-app

After executing "grails run-app", except using "Ctrl + C", is there a command to shutdown it? ...

How do I limit the number of results when using the Java driver for mongo db?

http://api.mongodb.org/java/2.1/com/mongodb/DBCollection.html#find(com.mongodb.DBObject,com.mongodb.DBObject,int,int) Using this with Grails and the mongo db plugin. Here's the code I'm using... not sure why but the cursor is returning the entire set of data. In this case, I'm just trying to return the first 20 matches (with is_proces...

Sorting query results according to parent property in grails

Is it possible in grails to sort query results according to a property of a parent class in a relationship. E.g. I have a user domain class which has a one to many relationship with a list of Tasks. When showing the list page of the Tasks domain class, I want to be able to sort the list of tasks by the associated User name. class User ...