This is a simple example demonstrating the usage of GORM outside Grails.
- The application loads Spring Beans definitions using the Grails Spring DSL
- Once the Spring Beans are accessible, some persons(domain objects) are persisted using a Spring Service.
- Gradle is used as build system and the project was tested under JDK6.
- This test application doesn’t work for Grails 2.3 and latest versions.
- For recent versions of Grails 2.4+, please refer to the gorm-standalone-example-2_4_x project.
Here are the main resources of the project:
- Gradle build file (
build.gradle
) - Spring bean definitions using the Grails Spring DSL (
src/main/resources/SpringBeans.groovy
) - Resource bundle for validation errors translations (
src/main/resources/message.properties
) - Log4j configuration (
src/main/resources/log4j.properties
)
- Dependency resolution and GORM (methods missing in some Spring Framework releases expected to be found by specific GORM versions)
- Other dependencies issues depending on the versions of Grails (grails-bootstrap), Spring Framework and GORM (grails-gorm)
- For domain operations, either use transactional services or make sure that the Hibernate session is bound:
domainClass.withNewSession
domainClass.withTransaction
Execute the following targets to test and run the application
On Unix/Linux platforms, run the following command:
./gradlew test run
For MS Windows please run the following command:
gradlew.bat test run
This is for people who would rather not use Gradle.
Please run the following command:
./gradlew idea eclipse
Please run the following command:
gradlew.bat idea eclipse