Groovy « Development « JPA Q&A

1. Grails Hibernate H2 problem

I have an application with two domain classes as follows:

DomainA : PK, name DomainB : PK, FK (points to DomainA.PK), name.
And when I try to ...

2. Grails: org.hibernate.TransientObjectException

Simple Groovy\Grails code:

def start = {

        def result = getJson(hotelSite, eng + index, [:])

3. Why don't Domain class static methods work from inside a grails "service"?

I want a grails service to be able to access Domain static methods, for queries, etc. For example, in a controller, I can call

to get the number of records in table "IncomingCall" but ...

4. Combine Hibernate class with @Bindable for SwingBuilder without Griffon?

I have implemented a back-end for my application in Groovy/Gradle, and am now trying to implement a GUI. I am using Hibernate for my data storage (with HSQLDB) per (with ...

5. grails / gorm / org.hibernate.type at TRACE prints nothing

I can't configure org.hibernate.type (logging bind variables used in hibernate prepared statements) using log4j.xml, but can using the log4j DSL in Config.groovy. We need to configure logging for different environments without ...

6. Tree structure in GORM (grails)

I'm trying to define a tree structure in GORM. Here is my model:

class Tree {
    String name
    Level rootLevel

    static hasOne = ...

7. Using JPA domain classes in Grails

I want to use a JPA domain model in an application developed using the latest Grails milestone (2.0.0.M1). The JPA domain classes are in the src\java directory of the application. Based on ...

8. uppercase first letter in play framework

I have installed jpagen module in my system in play framework. Which successfully generates class files but i want to generate setter and getter functions too using for get function i'm ...

9. Calling Hibernate in background threads in grails

I am trying to create a specific type of background processing setup in a grails application.

  • A fixed size thread pool exists only for the duration of the batch of jobs
  • A single ...

10. How to create a "view" domain object in Grails

I'm trying to adapt a legacy database to a grails application and I'm not sure how can I do it on grails. I have a huge table (with columns colA, colB, ...

11. Hibernate+GroovyTestcase: Unable to figure out the error in the code below ..

I am getting a test failure on the test below. Specifically it complains for "expect(" and it complains "incompatible return type" Test code

void testCreateTransitFileInfo()

12. Hibernate + Dynamic Groovy Class (Is this even possible)

Hey all, Having a mental exercise right now. I've got a file on my computer called User.groovy package com.test; import javax.persistence.*; import java.util.HashSet; import java.util.Set; import com.test.DataUtils; @Entity @Table(name = "user") public class User { public test() { def manager = DataUtils.getInstance().createEntityManager() manager.getTransaction().begin() manager.persist new User(name: "Peter") manager.getTransaction().commit() } @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name = "ID", nullable = false) Long id; ...