grails

could not initialize proxy - no Session

HI, I am using Grails 1.2.1 and I always got this message when I run my apps and leave it without anyone using the apps. org.hibernate.LazyInitializationException: could not initialize proxy - no Session at H__project_ilinkdev_grails_app_views_layouts_main_gsp$_run_closure2.doCall(H__project_ilinkdev_grails_app_views_layouts_main...

Grails - Language prefix in url mappings

Hi there im having problem with language mappings. The way i want it to work is that language is encoded in the url like /appname/de/mycontroller/whatever If you go to /appname/mycontroller/action it should check your session and if there is no session pick language based on browser preference and redirect to the language prefixed site....

How to set up an insert to a grails created file with next sequence number?

I'm using a JMS queue to read from and insert data into a postgres table created by grails. The problem is obtaining the next sequence value. I thought I had found the solution with the following statement (by putting "DEFAULT" where the ID should go), but it's no longer working. I must have changed something, because I needed to recreat...

Dynamic domain methods missing from grails service when injected into java service in grails app.

I had the idea that I would write my GroovyDao as a grails service. Next I would write a MyJavaService in java and locate it in the java sources dir in my grails app. MyJavaService contains a instance reference to groovyDao for spring injection. I would wire up in resources.groovy the MyJavaService with a groovyDao = ref("GroovyDao")....

POST with HTTPBuilder -> NullPointerException?

I'm trying to make a simple HTTP POST request, and I have no idea why the following is failing. I tried following the examples here, and I don't see where I'm going wrong. Exception java.lang.NullPointerException at groovyx.net.http.HTTPBuilder$RequestConfigDelegate.setBody(HTTPBuilder.java:1131) ... Code def List<String> se...

Multiple Grails Applications create Ehcache conflicts

I am running multiple Grails Applications on one of my servers. I am using Grails 1.2.2. I am using the default cache configuration in DataSource.groovy. When I try and run two Grails applications, they both seem to be using/writing to: /tmp/org.hibernate.cache.UpdateTimestampsCache.data When I look at how to customize Ehcache with an ...

Grails/Hibernate max for string type

Hello, In my table I have a serial number field, which is represneted by string.. It has a prefix and some numbers follow. Eg: ABC1234, ABC2345 etc. How to retrieve the largest value (max equivalent of int type) from this column. In my case it would be ABC2345. I probably could retrieve all the data,, sort it and get the same, but that...

How to refer to another property in a custom Grails validator?

I have a property that can be nullable or required depending on the status of another variable. class Person{ name() civilStatus(inList:['Single','Married','Divorced','Widowed']) partnerOrSpouse() } the partnerOrSpouse property is nullable or not depending on the value of the civilStatus property. ...

Grails pattern to reuse template on error

Hello, I have a gsp template, where the data for create view is passed through the controller. def create = { def bookInstance = new Book() bookInstance .properties = params def map = getDefaultValues() render(template: "create", model: [bookInstance : bookInstance , title: map.title, somelist: somelist ...

Groovy Grails, How do you stream or buffer a large file in a Controller's response?

Hi Guys I have a controller that makes a connection to a url to retrieve a csv file. I am able to send the file in the response using the following code, this works fine. def fileURL = "www.mysite.com/input.csv" def thisUrl = new URL(fileURL); def connection = thisUrl.openConnection(); def output = connection.content.t...

Grails/Acegi disabled users question

Hi, I have a Grails app with acegi security, and I just found some users with their "enabled" field in false, when they were set to true after an approval process. My question is: May it have happened because of a maximum login attempts reached ? If so, where is it configured ? Thanks. ...

How to set offset in GORM when using createCriteria?

I'm just wondering if it's possible for 'createCriteria' to specify the paginateParams (i.e. offset) similar to dynamic finder (findAll, etc.) Note that this code is not working since 'offset' is not documented in http://www.grails.org/doc/1.2.1/ref/Domain%20Classes/createCriteria.html def c = SnbrItemActDistance.createCriteria() def r...

Prevent Flash-Message showing up twice (on page with error and on next page)

If there is an error in a form my grails application this results in a flash message. If I then go to another page, the (old) flash message shows up again on the new page. How do I prevent this? ...

Using @Secured Annotation causes IS_FULLY_AUTHENTICATED problem in grails

I'm using Acegi/Spring Security in grails and when i use the annotations like @Secured(['ROLE_ADMIN']) it denies my login even though the user is part of ROLE_ADMIN. In looking through the login is it seems that it's getting an IS_AUTHENTICATED_FULLY role also but I have never added that to a page so i'm not sure how to bypass that. I re...

grails and flash movie

Is it possibe to insert into GSP simple flash movie? I tried this way: <object type="application/x-shockwave-flash" data="${resource(dir:'flash',file:'movie.swf')}" width="400" height="400"> <param name="movie" value="${resource(dir:'flash',file:'movie.swf')}" /> <param name="bgcolor" value="#ffffff" /> ...

linode.com vs slicehost.com: which fits Java applications better?

Dear friends, I've been searching for a hosting solution for a grails application. I've read some very good comments on slicehost, but not much about linode. could some one with the experiences of either of them share your insights please? thanks. ...

java.lang.NoClassDefFoundError: groovyx.net.http.HTTPBuilder

When I run my grails application locally under Tomcat, I get no errors. When I deploy my WAR on my remote web server, I get this exception when I try to make an AJAX request that uses HTTPBuilder. How could this be happening? ...

How to exclude params from XML rendered in Grails ?

Hi, I have a class : class Category { String name SortedSet items static hasMany = [items:Item] } Inside the controller, I render category as XML (converters) : def getCategory = { render Category.read(1) as XML } But I want exclude items from the rendering. How can I do ? Thanks ...

How to force grails GORM to respect DB scheme ?

I have two domains : class CodeSet { String id String owner String comments String geneRLF String systemAPF static hasMany = [cartridges:Cartridge] static constraints = { id(unique:true,blank:false) } static mapping = { table 'code_set' version false columns { id column:'code...

What is the best way to declare sorted association in grails domain classes ?

It seems that there are two different ways of declaring sorted associations in Grails : Method 1 (see here) using default sort order class Book { String title } class Author { static hasMany = [books : Book] static mapping = { books sort: "title"} } Method 2 (see here) using SortedSet class Book implements Comparable { Stri...