In my grails application I want to read some values from properties file and set it to Grails Domain class static property at startup.
Example
Class A{
static myValues="1,2";
}
class B{
static myValues="2,3";
}
In the above example I have directly given the inputs..Instead of that I want to read it from one config.propert...
How can I use grails domain classes (which is in groovy) in service layer which is in Java/Spring.
When using the grails MVC, everything is fine as I can use controller to access domain objects and call CRUD and other dynamic methods on them. But, what I am wondering is is there a clean way to do it from Java - say the service layer. F...
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...
In grails, I can implement an N:1 relationship like this:
class Parent { hasMany = [children:Child] }
class Child { belongsTo = [parent:Parent] }
Now (if addTo and removeFrom is always properly used) I can get a Parent's children via parent.children.
But I can also do it without hasMany:
class Parent { }
class Child { belongsTo = ...
Following grails domain class:
class MyClass {
Map myMap
}
Now for myMap, grails automatically creates a new table for the elements in the map. However if I add elements which are too long (e.g. 1024 characters), I get a DB error.
Can I somehow tell grails to make the respective column in myMap's table big enough to allow for large...
Controller for a Bug:
this is the create method for a bug, I printed out bugInstance.activities and it had my activity object in it
def create = {
def bugInstance = new Bug()
def activity = new Activity(description:"created")
bugInstance.properties = params
bugInstance.addToActivities(activity)
...
I need to create grails domain class like this(see image),but I don't know how to do. Can someone please give me the solution,please?
Image : http://www.uppicweb.com/x/i/ib/6demo.jpg
...
Hi,
i have a requirement to allow the user to define some custom field in one of the system entities. do you have any suggestion/pattern/plugin that will help me add this feature to my application.
thanks,
Meni
...
Hi,
I have two domain classes with 1:n relationship:
import Action
class Task {
Action actionParent
String taskName
}
and
class Action {
String actionName
}
I have the list of Tasks where I have the column "Action name", I would like to sort this column by Action.actionName. Now I'm using the createCriteria() meth...
I am a complete noob when it comes to grails (and still very noobish when it comes to groovy) so I apologise if this is a dumb question.
I am building a simple web app and I want to control portions of the domain in my app based on file system objects (i.e. directory structure and file type) rather than database data. How easy is it to ...
Hi all, I'm grails newbie.i want to mapping primary key with VARCHAR2 and generate primary key using my method to generated its.how to solve this problem?
...
For now I have field "String firstName" it converted to "first_name" and i want "firstname" as default in Hibernate. Is it posible?
...
I am porting a Grails application from Oracle to MySQL database. The original Oracle version is a legacy database which uses a few complex Views leveraging Oracle's INSTEAD OF INSERT OR UPDATE feature which MySQL doesn't have. As a workaround I have implement Insert and Update methods on the Domain classes which point to these kinds of V...
Hi,
I have HttpSessionListener to listen for when sessions are created and destroyed. I have a user domain which has loggedIn boolean column which I update whenever user logs in or logs out which I use for admin management. I also store the session Id in the database.
I also want to update the loggedIn column whenever the session is de...
I'm writing a Groovy script (as part of a Grails plugin) and I want to get a list of properties for a GrailsDomainClass that a user of my plugin might define. I can do this using domainClass.properties (where domainClass is a GrailsDomainClass).
However, suppose a user has the grails domain class:
class Example {
String name
...
I need to validate save action between 3 domains, here is relationship :
User - JobProcess : one-to-many, JobProcess - Heatmap : one-to-many.
User { static hasMany = [ jobs : JobProcess ] ... }
JobProcess { static hasMany = [ heatmaps : Heatmap ] ... User script ... }
Heatmap { static belongsTo = JobProcess ... JobProcess job ... }
I...
Hello,
I am wondering if is possible to implement following domain model.
Let's have a domain class which contains set of intervals (joda time). I can use org.joda.time.contrib.hibernate.PersistentInterval hibernate user type for mapping of Interval to database table (by similar way as in http://www.grails.org/JodaTime+Plugin). However...
I'm using the Grails Webflow plugin. Here are the domain objects I'm working with:
class Foo implements Serializable {
String fooProp1,
fooProp2
static constraints = {
fooProp2 nullable: false
}
}
class Bar implements Serializable {
Foo fooObject
static constraints = {
fooObject nullabl...