Does anybody know what is the best approach to accessing a sql view through Grails (or if this is even possible)? It seems an obvious way of doing this would be to use executeQuery against the view to select a collection of rows from the view which we would not treat as a list of domain objects. However, even in this case it is not obvio...
I'm trying to mix-in a class in my Groovy/Grails app, and I'm using the syntax defined in the docs, but I keep getting an error.
I have a domain class that looks like this:
class Person {
mixin(ImagesMixin)
// ...
}
It compiles fine, but for some reason it won't work. The file containing ImagesMixin is located in my /src/groovy/...
There are essentially 2 places to define JavaScript functions in Grails, directly in a element on the GSP, and within a separate javascript source file under /web-app/js (for example, application.js). We have defined a commonly reused javascript function within application.js, but we also need to be able to generate parts of the functio...
Per an answer to a previous question (answer here: http://stackoverflow.com/questions/425294/sql-database-views-in-grails#427691), I have tried to use a domain class to represent a view in my database. This works wonderfully in most cases, however:
I have a view with no single unique key. Let's say the underlying tables look like this:
...
I'm using Grails 1.1 beta2. I need to import a large amount of data into my Grails application. If I repeatedly instantiate a grails domain class and then save it, the performance is unacceptably slow. Take for example importing people from a phone book:
for (each person in legacy phone book) {
// Construct new Grails domain class f...
In a Grails domain class, how do I set the constraint for a String field so that its MySQL column type is TEXT or LONGTEXT?
So far my best approach is to set the constraint's size:
myTextField(size:0..65535)
which results in TEXT
myTextField(size:0..2147483646)
results in LONGTEXT (2147483646 = 2^32 / 2 - 1 - 1)
Is there a clean...
I am in the training of web developement.I want make a page which shows all the files in the D://downloads directory.I made that part in grails.If i click on the particular file i want download that file.I dont know how to make that part.I did a google search.But i cannot do that.
My code is
<g:each in="${fileList}" var="filename" st...
I'm doing my first experiments with Grails and am looking for a way to have fields represented by a combobox (such as one-to-one domain associations and numbers with a narrow range constraint) to be optional, i.e. there should be an empty entry in the combobox.
How can this be achieved? I've tried both adding a nullable:true constraint ...
Let's say I have a class called Store that has many Employees. My RESTful listXML method looks like this:
def listXML = {
render Store.list() as XML
}
And the result looks like this:
<stores>
<store id="1">
<name>My Store</name>
<employees>
<employee id="1" />
</employees>
</store>
</store>
My question is, how...
I am writing my first taglib as part of a plugin and I would like to document it. Adding javadoc (is there any place that documents groovydoc or is it really the same thing?) doesn't seem to work for non-methods.
Specifically, is it possible to document the def mytag in:
/**
* This doc shows up
*/
class MyTagLib {
static namespace ...
How do I count the number of messages where my body length is between 0 and 25 characters long?
Message.countBy('from Message m where m.body.length <= 25')
Unfortunately for me, countBy does not take a string parameter.
...
So far i've collected the following:
*.iws
*.war
.classpath
.DS_Store
.project
.settings
/*.launch
/*.tmproj
/out/**
stacktrace.log
test/reports
Any other suggestions?
...
What's the accepted procedure and paths to configure jdk and global library source code for Intellij IDEA on OS X?
...
I'm trying to take a given URL entered by user and determine if the URL is pointing to a image or a video.
Example use case.
When a user paste in the URL of a youtube video, on save the page will auto display the embedded Youtube player.
When a user poaste int he URL of a picture in flickr, on save, the page will auto display a small...
This is the controller
class JavaMailerController {
JavaMailerService javamailerservice
def x = {javamailerservice.serviceMethod()} }
This is the Service
import javax.mail.; import
javax.mail.internet.; import
java.util.*;
class JavaMailerService {
boolean transactional = false
def serviceMethod() { String d_ema...
When using Grails 1.0.4 together with a MySQL the charsets of the auto-generated database tables seem to default to ISO-8859-1. I'd rather have everything stored as pure UTF-8. Is that possible?
From the auto-generated database definitions:
ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=latin1;
Note the "latin1" part.
...
I'm writing a small webapp in Grails and I have the following question regarding best practices for controller design and using GORM:
I'm storing the user object in session.user. Currently all my action methods start with the following code to make sure a valid user is logged in and that the user object is fresh:
class FooController {
...
I'm writing a small Grails app, and I keep on getting StaleObjectStateException:s for about 1/10:th of the calls to "createfoo" when running the following rather simple code. Most probably I'm missing out on the best way to use GORM.
This is the code:
def viewfoo = {
session.user.refresh()
// ...
}
def createfoo = {
session.user...
I'd just like to play a little bit with groovy
I was thinking about developing my own-tiny web framework, something very simple and manageable...
So i'd like tou use GSP pages whtout having to install the whole grails stuff, with all its dependencies and behind-the-scenes frameworks...
can anyone provide me detailed instructions on wh...
I need to find out the physical path of a grails GSP file.
My requirement is that I want to create a new layout file at run-time and use that in the application.
I have been able to achieve this without problem when the application runs on jetty (grails run-app), however, when I deploy the app on Jboss, the path at which the file nee...