Skip to content

Commit 63a1a02

Browse files
authored
Merge pull request #4 from felipe-gdr/hibernate-example
Hibernate example
2 parents 93f0aae + d6fd991 commit 63a1a02

22 files changed

Lines changed: 1082 additions & 0 deletions

hibernate-example/build.gradle

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
buildscript {
2+
ext {
3+
springBootVersion = '2.0.5.RELEASE'
4+
}
5+
repositories {
6+
mavenCentral()
7+
}
8+
dependencies {
9+
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
10+
}
11+
}
12+
13+
apply plugin: 'java'
14+
apply plugin: 'eclipse'
15+
apply plugin: 'org.springframework.boot'
16+
apply plugin: 'io.spring.dependency-management'
17+
18+
group = 'com.graphql-java'
19+
version = '0.0.1-SNAPSHOT'
20+
sourceCompatibility = 1.8
21+
22+
repositories {
23+
mavenCentral()
24+
maven { url "http://dl.bintray.com/andimarek/graphql-java" }
25+
}
26+
27+
28+
dependencies {
29+
compile('org.springframework.boot:spring-boot-starter-web')
30+
compile('org.springframework.boot:spring-boot-starter-data-jpa')
31+
compile("com.h2database:h2")
32+
compile "com.graphql-java:graphql-java:10.0"
33+
compile 'com.google.guava:guava:26.0-jre'
34+
compile("org.springframework.boot:spring-boot-devtools")
35+
testCompile('org.springframework.boot:spring-boot-starter-test')
36+
}
53.4 KB
Binary file not shown.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#Sat Sep 15 15:12:07 AEST 2018
2+
distributionBase=GRADLE_USER_HOME
3+
distributionPath=wrapper/dists
4+
zipStoreBase=GRADLE_USER_HOME
5+
zipStorePath=wrapper/dists
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-4.8.1-all.zip

hibernate-example/gradlew

Lines changed: 172 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

hibernate-example/gradlew.bat

Lines changed: 84 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

hibernate-example/readme.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# graphql-java-hibernate-example
2+
3+
An example of a simple graphql-java implementation backed by a Hibernate repository (via Spring Data JPA) and
4+
integrated with Spring Boot.
5+
6+
It shows how data fetchers can use Hibernate repositories to query the database.
7+
8+
In memory H2 is being used as the database, SQL scripts are execute during startup to add some sample data to
9+
the database. You can find those scripts in [data.sql](src/resources/data.sql).
10+
11+
# Running the example
12+
To build the code type
13+
14+
./gradlew build
15+
16+
To run the code type
17+
18+
./gradlew bootRun
19+
20+
Point your browser at
21+
22+
http://localhost:8080/
23+
24+
25+
Some example graphql queries might be
26+
27+
{
28+
hero {
29+
name
30+
friends {
31+
name
32+
friends {
33+
id
34+
name
35+
}
36+
37+
}
38+
}
39+
}
40+
41+
42+
or maybe
43+
44+
{
45+
luke: human(id: "1000") {
46+
...HumanFragment
47+
}
48+
leia: human(id: "1003") {
49+
...HumanFragment
50+
}
51+
}
52+
53+
fragment HumanFragment on Human {
54+
name
55+
homePlanet
56+
friends {
57+
name
58+
__typename
59+
}
60+
}
61+
62+

hibernate-example/settings.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
rootProject.name = 'hibernate-example'

0 commit comments

Comments
 (0)