grails « Development « JPA Q&A

1. MappedSuperclass Alternatives in Grails

In many past projects, I used this JPA / Hibernate approach to add auditing capabilities to a system. It's very ...

2. GORM in Grails and StaleObjectStateException

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 ...

3. File attachments broken upgrading to grails 1.1.1 from grails 1.1-beta3

This is a rather specific upgrade path, but it's what I'm on. I think I tried going to 1.1 as well, and had the same problem, but not 100% sure. Anyway, ...

4. many domains = much memory usage?

I would like to know if for example, I have about 80 domains on my projects, does it means that the 80 domains will be loaded into memory when I run ...

5. Re-using a JoinTable in grails

I have two domains that have a many-to-many relationship. Example:

class LibraryUser {
    String name
    static hasMany = [ checkedoutBooks : Book ]

class Book {

6. Is there a nice GUI available for showing Hibernate statistics?

Hibernate exposes many internal metrics via the Statistics API. Is there an easy-to-use GUI that I can use to visualize these statistics? Bonus if there is a Grails plug-in ...

7. 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 ...

8. grails unidirectional one-to-many

this has been bugging me, lets say i have two model, category and product

class Category {
  static hasMany = [products : Product]
  String name
class Product {
  String name
now, i ...

9. Using an existing GORM data model in standalone Java app

I have an existing Grails app and a separate, existing Java app. I would like the Java app to access the same database schema as the Grails app. Is ...

10. Gorm returned value type

I have an object Foo with a hasMany association to a Bar object

class Foo {
 String value
 static hasMany = [
  bars: Bar

class Bar {
 String value
when i ...

11. Why are my grails JMS messages processing services using stale data?

We've built a grails application which integrates with a legacy system through JMS messages and distributes large batch jobs leveraging a JMS queue. We use the grails JMS plugin in ...

12. Need advice about school project

I was asked to develop a middle-scale project for university this year - to be more specific, it is a traffic Report manager. I was told that i need to use ...

13. Problem Grails with many-to-may

I'm programming in Grails 1.3.x, and I have a problem with a query I want to do with 2 tables related to "many to many. " I have a table called "Group" ...

14. Grails hook into GORM beforeUpdate()

I have an internal requirement with nested domain classes where I want updates to a parent relationship to be propagated to children. A code example may make it clear:

class Milestone {

15. Grails - Hibernate XML and Domain Classes

I inherited a Grails project that has both Hibernate .xml files AND Domain classes for the Model. This thread leads me to believe that that is not correct. ...

16. Hibernate/Domain NullPointerException?

Context: I am trying to upgrade a Grails project from 1.0.3 to 1.3.7 and am running into a bunch of problems. I just was getting a lot of

17. Grails - Hibernate XML - Dynamic Methods

I have a Grails project that is using Hibernate XML. The Hibernate file are all in conf/hibernate/[DomainName].hbm.xml and the matching source domain files are in src/groovy/[DomainName].groovy I keep getting:


18. help on error org.hibernate.StaleObjectStateException

Please help me get around this error . It comes sometimes at other times it does. I know its because of concurrent requests but how to overcome it ?? I tried ...

19. How to have a common base type for domain classes in GORM GRAILS?

If i have something like...

class Tiger{
    int id
    String name

class Giraffe{
    int id
    String name
How can i have it ...

20. Grails. GORM. Error creating new instances

I've integrated the existing hibernate mappings into a grails application. Dynamic finders works ok, also foreign keys are resolved ok. But I can't save new instances of domain classes. Note: I don't ...

21. hibernate/compass failing to create index

I am getting the following error when trying to start my grails project which is using the searchable plugin:

Running Grails application..
2011-11-29 10:16:43,164 ERROR [indexer.ScrollableHibernateIndexEntitiesIndexer] {hibernate}: Failed to index the database
org.compass.core.engine.SearchEngineException: Processor ...

22. Grails and JPA integration

I'm trying to integrate a Java domain and service layer with a Grails app. The Java projects are built with Maven and the Grails project loads the JARs from the Maven ...