grails

Grails UrlMappings with "-" as a separator

I want to separate String params with a "-" in a url. I had configurate UrlMappings with: name friendlyurl: "/${productId}-${title}_url"{ controller = "product" action = "index" } The productId is in the form stringnumber, like ESE123 The product controller needs the param productId. It works with url like: ESE1234-asdlashdlasj...

grails / groovy / cxf / jaxb - hibernate persisted entity marshalled as empty

Expecting grails domain object to be written to XML response: Image.groovy: @XmlRootElement @XmlAccessorType(XmlAccessType.NONE) class Image{ @XmlElement String url @XmlElement String contentType } WebServiceRequestHandler.groovy: @GET @Path("/myrestfullmethod/parameter1/{parameter1name} @Produces("text/xml") Images...

Is a variable declaration in grails the same as a belongsTo relationship?

Hello all, I am trying to set up a few domain classes. I will explain it in english, and I am wondering how the domain would be set up in grails. Capitalized words are my domains An Employee has an Education. An Employee has many Employer (past and present). An Employee had one or many Project for each Employer. Project have a Role, Cl...

Grails actions getting called twice. Help!

Hello community! I'm writing a grails app and running into a strange problem. When clicking the submit button on a page, the associated action gets called twice in rapid succession. This causes everything to break horribly. Has anyone else seen this issue before? Below is my code: From the GSP page: <g:form method="post" action="show"...

In grails, why do I have to create a variable for criteria?

I can write: def c = Transaction.createCriteria() def transactions = c.list { projections { groupProperty("product") countDistinct("id") } maxResults(pageBlock) firstResult(pageIndex) } But can't write this: def transactions = Transaction.createCriteria() .list { projections { groupPropert...

grails: dynamically adding associations

Mormally setting up one-to-many associations is easy. Take for example: class Author { String firstName String lastName static hasMany = [books: Book] static constraints = { books(nullable: true) } } class Book { String title Author author Publisher publisher static constrai...

How to use Grails with BIRT report and show BIRT web viewer

I installed the birt-report plugin on a Grails web application project but I cannot understand to use it. I have 2 use cases: Generate BIRT web viewer and show on GSP Page (Show chart report) Generate BIRT report to some other file format (PDF, Word, etc.) Can anyone please provide examples of how to do this? ...

XML sitemap in Grails

Hi there, I am trying to figure out the best way to generate an XML sitemap (as described here: http://www.sitemaps.org/) for a Grails application. I am not aware of any existing plugins that do this so I might build one. However, I wanted to get the community's input first. Aside from supporting standard controllers/actions, I am thinki...

Grails Enum Mapping

in Grails, Is there a way to limit the size of the column to which the enum is mapped. In the following example, i would like the column type to be char(2) enum FooStatus { BAR('br'), TAR('tr') final static String id } class Foo { FooStatus status static constraints = { status(inList:FooStatus.values()*.id,size...

Scope of form variables in Grails

Hi, I am creating a Grails application which has an input page with text fields. Here the user can type in the data and on submit, the control goes to the action in controller. Here I get the value of the form data using params.empName etc. But the scope of this data is very small and doesnt get carried on if I do a redirect from the c...

Grails - How to Unit Test addTo*

Is it possible to unit test addTo* functions in Grails ? thanks for your help. ...

@XmlSeeAlso with more than one parameter

http://download.oracle.com/javase/6/docs/api/javax/xml/bind/annotation/XmlSeeAlso.html According to this, I should be able to make my root element have more than one class reference. However, when I try that, I get this exception: [groovyc] Compiling 72 source files to C:\Users\dcole\.grails\1.3.4\projects\trunk\classes [groovyc] org.c...

In Grails, how do I return to the calling current view from a controller?

Below is a very simple controller with a "search" action that is fired from g:submitButton in a gsp file. My question is, instead of redirecting to the "index" action and view, how do I return to the view that contained the submit button that called this controller's search action? class DefaultSearchController { def searchableServi...

How to I render validation results in a Grails Web Flow?

I have a Grails WebFlow that is similar to the following example: def myFlow = { init { action { def domain = MyDomain.get(params.id) flow.domain = domain ? domain : new MyDomain() } on('success').to 'first' } first { on('continue') { flow.domain.properties...

Grails: No signature of method findAll() is applicable for argument types: String, ArrayList

I'm new to grails and receive the following error: No signature of method: Something.findAll() is applicable for argument types: (java.lang.String, java.util.ArrayList) values: [from Something AS s WHERE s.some_number LIKE ?, [%asdf%]]" The error occurs when I run test-app. It occurs in the following place: SomethingVO[] findBySomeN...

How to run Gant targets from within a Grails controller?

Suppose I have a block of Gant code: target(echo:"test"){ ant.echo(message:"hi") } setDefaultTarget("echo") This is usually run from a command line. How could I place the block in a Grails controller and run it from there? ...

Logging failed login attempt in grails

I'm using acegi security in Grails. Is there a way to log a failed login attempt as info or warning so: ERROR springsecurity.GrailsDaoImpl - User not found: XXXXXX is logged as required ? Thanks ...

Grails: Is there a way to have findAll() without a query but with pagination and sorting?

As I noticed in the answers of another question there are a few problems when testing finder methods in GORM. I want to get all objects from Something and have support for sorting and pagination, so I wrote this: SomethingListVO findAllSomethings(int offset = 0, int limit = 50) { def somethingCount = Something.count() def some...

org.hibernate.MappingException for domain classes in grails

I have a grails project and everything has been running fine. I started adding JAXB XML annotations to my groovy domain classes and all of a sudden I start getting this stack dump. What do I need to do to fix this, and why is it showing up after I started added the XML annotations? 2010-09-21 09:46:43,006 [main] ERROR context.ContextLoa...

How to ship database updates?

I have a Java application (generic) that uses a database via hibernate. I ship it via jar to clients. Which is the best way to ship database updates (schema and data) to clients? Consider that clients can have different version of my application, and the update must be automatic, without user support. And if the application is written w...