groovy « Map « JPA Q&A

1. Result set mapping in Grails / GORM

I want to map the result of a native SQL query to a simple bean in grails, similar to what the @SqlResultSetMapping annotation does. For example, given a query select,, z.baz ...

2. grails / GORM / hibernate - hasMany map not synchronised on save() of parent

Problem deleting associated entities and having this change persisted to the database. Have a groovy object parent which has many child entities associated with it. When we find this domain object and ...

3. Grails formula field not found

This questions concerns the use of the formula field in a static mapping block in Grails. I am trying to implement a very simple domain class that uses a formula mapping (derived ...

4. How do I map entities in GORM when pk of one references pk of another

What is the best way to map two entities in GORM when the primary key of one table is also a foreign key from another table. For ex: Here is one table:


5. Grails GORM mapping tries to access field "class" which exists nowhere

This is pretty strange.

class Service implements Serializable{

Integer id
String serviceName
String description
SortedSet serviceRequirements

static hasMany = [ serviceRequirements : ServiceRequirement]

static mapping = 
    table 'service'

    columns {

6. Correct Hibernate type for TimeDuration in grails/groovy domain class?

using TimeDuration in one of my Grails/Groovy classes I get an exception when starting the grails app.

org.hibernate.MappingException: Could not determine type for: groovy.time.TimeDuration
usage in domain class
import groovy.time.TimeDuration
class Result {