-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
correctly working example, guide start
- Loading branch information
Showing
38 changed files
with
229 additions
and
145 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
springBootVersion=1.5.4.RELEASE | ||
grailsVersion=N/A - Spring Boot Version: 1.5.4.RELEASE | ||
gormVersion=6.1.5 | ||
gradleWrapperVersion=3.5.1 |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
#Mon Nov 23 22:21:31 EST 2015 | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-2.7-all.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-3.5.1-bin.zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
complete/src/main/groovy/demo/GORMwithoutGrails/domain/Driver.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package demo.GORMwithoutGrails.domain | ||
|
||
import grails.gorm.annotation.Entity | ||
|
||
@Entity | ||
class Driver extends User { | ||
|
||
String name | ||
|
||
static hasMany = [ vehicles: Vehicle ] | ||
|
||
static mapping = { | ||
version false | ||
} | ||
|
||
static constraints = { | ||
vehicles nullable: true | ||
} | ||
} |
7 changes: 6 additions & 1 deletion
7
complete/src/main/groovy/demo/GORMwithoutGrails/domain/Make.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,17 @@ | ||
package demo.GORMwithoutGrails.domain | ||
|
||
import grails.gorm.annotation.Entity | ||
import org.grails.datastore.gorm.GormEntity | ||
|
||
@Entity | ||
class Make { | ||
class Make implements GormEntity<Make> { | ||
|
||
String name | ||
|
||
static mapping = { | ||
version false | ||
} | ||
|
||
static constraints = { | ||
} | ||
} |
7 changes: 6 additions & 1 deletion
7
complete/src/main/groovy/demo/GORMwithoutGrails/domain/Model.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,17 @@ | ||
package demo.GORMwithoutGrails.domain | ||
|
||
import grails.gorm.annotation.Entity | ||
import org.grails.datastore.gorm.GormEntity | ||
|
||
@Entity | ||
class Model { | ||
class Model implements GormEntity<Model> { | ||
|
||
String name | ||
|
||
static mapping = { | ||
version false | ||
} | ||
|
||
static constraints = { | ||
} | ||
} |
16 changes: 0 additions & 16 deletions
16
complete/src/main/groovy/demo/GORMwithoutGrails/domain/Person.groovy
This file was deleted.
Oops, something went wrong.
28 changes: 28 additions & 0 deletions
28
complete/src/main/groovy/demo/GORMwithoutGrails/domain/User.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package demo.GORMwithoutGrails.domain | ||
|
||
import groovy.transform.EqualsAndHashCode | ||
import groovy.transform.ToString | ||
import org.grails.datastore.gorm.GormEntity | ||
|
||
@EqualsAndHashCode(includes='username') | ||
@ToString(includes='username', includeNames=true, includePackage=false) | ||
class User implements Serializable, GormEntity<User> { | ||
|
||
private static final long serialVersionUID = 1 | ||
|
||
String username | ||
String password | ||
boolean enabled = true | ||
boolean accountExpired | ||
boolean accountLocked | ||
boolean passwordExpired | ||
|
||
static constraints = { | ||
password nullable: false, blank: false, password: true | ||
username nullable: false, blank: false, unique: true | ||
} | ||
|
||
static mapping = { | ||
password column: '`password`' | ||
} | ||
} |
6 changes: 5 additions & 1 deletion
6
complete/src/main/groovy/demo/GORMwithoutGrails/domain/Vehicle.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
spring.h2.console.enabled=true | ||
spring.h2.console.path=/console | ||
spring.datasource.platform=h2 | ||
spring.datasource.platform=h2 | ||
#spring.jpa.properties.hibernate.hbm2ddl=auto | ||
#spring.jpa.hibernate.ddl-auto=create-drop | ||
spring.jpa.properties.hibernate.hbm2ddl.auto=create-drop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
dataSource: | ||
pooled: true | ||
dbCreate: create-drop | ||
url: jdbc:h2:mem:devDb | ||
driverClassName: org.h2.Driver | ||
username: sa | ||
password: | ||
hibernate: | ||
cache: | ||
queries: false | ||
use_second_level_cache: true | ||
use_query_cache: false | ||
region.factory_class: org.hibernate.cache.ehcache.EhCacheRegionFactory |
File renamed without changes.
22 changes: 22 additions & 0 deletions
22
complete/src/test/groovy/demo/GORMwithoutGrails/domain/DriverSpec.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package demo.GORMwithoutGrails.domain | ||
|
||
import grails.gorm.transactions.Rollback | ||
import org.grails.orm.hibernate.HibernateDatastore | ||
import spock.lang.AutoCleanup | ||
import spock.lang.Shared | ||
import spock.lang.Specification | ||
|
||
class DriverSpec extends Specification { | ||
|
||
@Shared @AutoCleanup HibernateDatastore datastore = new HibernateDatastore(getClass().getPackage()) | ||
|
||
@Rollback | ||
def "Driver created with name"() { | ||
when: | ||
final driverInstance = new Driver(name: 'Test Driver', username: 'td', password: 'password1') | ||
driverInstance.save(flush: true) | ||
|
||
then: | ||
Driver.count() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
complete/src/test/groovy/demo/GORMwithoutGrails/domain/ModelSpec.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package demo.GORMwithoutGrails.domain | ||
|
||
import grails.gorm.transactions.Rollback | ||
import org.grails.orm.hibernate.HibernateDatastore | ||
import spock.lang.AutoCleanup | ||
import spock.lang.Shared | ||
import spock.lang.Specification | ||
|
||
class ModelSpec extends Specification { | ||
@Shared @AutoCleanup HibernateDatastore datastore = new HibernateDatastore(getClass().getPackage()) | ||
|
||
@Rollback | ||
def "Model created with name"() { | ||
when: | ||
final modelInstance = new Model(name: 'Test Model') | ||
modelInstance.save(flush: true) | ||
|
||
then: | ||
Model.count() | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
complete/src/test/groovy/demo/GORMwithoutGrails/domain/VehicleSpec.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package demo.GORMwithoutGrails.domain | ||
|
||
import grails.gorm.transactions.Rollback | ||
import org.grails.orm.hibernate.HibernateDatastore | ||
import spock.lang.AutoCleanup | ||
import spock.lang.Shared | ||
import spock.lang.Specification | ||
|
||
class VehicleSpec extends Specification { | ||
@Shared @AutoCleanup HibernateDatastore datastore = new HibernateDatastore(getClass().getPackage()) | ||
|
||
@Rollback | ||
def "Vehicle created with a name"() { | ||
when: | ||
final makeInstance = new Make(name: 'Ford') | ||
final modelInstance = new Model(name: 'Test Model') | ||
final vehicleInstance = new Vehicle(name: 'Test Vehicle', make: makeInstance, model: modelInstance) | ||
vehicleInstance.save(flush: true) | ||
|
||
then: | ||
Vehicle.count() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
title=Build a Grails 3 application with the Vaadin 8 Framework | ||
subtitle=Learn how to build a Grails 3 application with the Vaadin 8 Framework | ||
title=Build a Spring Boot application with GORM | ||
subtitle=Learn how to build a Spring Boot using GORM | ||
authors=Ben Rhine | ||
copyright=Copies of this document may be made for your own use and for distribution to others, provided that you do not charge any fee for such copies and further provided that each copy contains this Copyright Notice, whether distributed in print or electronically. All guides are released with an ASLv2 license for the code, and Creative Commons license for the writing. | ||
githubSlug=grails-guides/vaadin-grails | ||
githubSlug=grails-guides/GORM-without-Grails | ||
githubBranch=master | ||
tags=vaadin,frontend,framework | ||
category=Grails + Frontend Framework | ||
tags=spring boot,backend,GORM, hibernate | ||
category=Spring Boot + GORM |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
Since this is Spring Boot and not Grails we have to do a little bit more setup that we | ||
are used to. In your top level project directory create a `gradle.properties` file. | ||
|
||
[source,bash] | ||
---- | ||
$ touch gradle.properties | ||
---- | ||
|
||
After you have created run the above command your new file should be on the same level | ||
as your `build.gradle` file. | ||
|
||
image::gradleProperties.png[] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
In this guide you are going to build a Grails 3 application with the Vaadin 8 Framework. | ||
In this guide you are going to build a Spring Boot application using GORM. |
Oops, something went wrong.