Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
HibernateOGMExamples
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
We are moving to Forgejo!
You are on a read-only GitLab instance.
Show more breadcrumbs
Jeffrey Phillips Freeman
HibernateOGMExamples
Commits
be78ef1c
Commit
be78ef1c
authored
10 years ago
by
Jeffrey Phillips Freeman
Browse files
Options
Downloads
Patches
Plain Diff
Added a unit test for blueprints-jpa it isnt currently working though
parent
92a0facf
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
pom.xml
+11
-0
11 additions, 0 deletions
pom.xml
src/test/java/com/syncleus/grail/graph/hibernate/DogBreedTest.java
+32
-0
32 additions, 0 deletions
...java/com/syncleus/grail/graph/hibernate/DogBreedTest.java
with
43 additions
and
0 deletions
pom.xml
+
11
−
0
View file @
be78ef1c
...
...
@@ -87,5 +87,16 @@
<version>
1.2.17
</version>
<scope>
runtime
</scope>
</dependency>
<dependency>
<groupId>
org.slf4j
</groupId>
<artifactId>
slf4j-api
</artifactId>
<version>
1.7.7
</version>
<scope>
runtime
</scope>
</dependency>
<dependency>
<groupId>
com.wingnest.blueprints
</groupId>
<artifactId>
blueprints-jpa-graph
</artifactId>
<version>
2.5.0_01
</version>
</dependency>
</dependencies>
</project>
This diff is collapsed.
Click to expand it.
src/test/java/com/syncleus/grail/graph/hibernate/DogBreedTest.java
+
32
−
0
View file @
be78ef1c
...
...
@@ -2,6 +2,7 @@ package com.syncleus.grail.graph.hibernate;
import
com.syncleus.grail.graph.hibernate.domain.Breed
;
import
com.syncleus.grail.graph.hibernate.domain.Dog
;
import
com.tinkerpop.blueprints.Vertex
;
import
junit.framework.Assert
;
import
org.hibernate.ogm.util.impl.Log
;
import
org.hibernate.ogm.util.impl.LoggerFactory
;
...
...
@@ -11,6 +12,7 @@ import javax.persistence.EntityManager;
import
javax.persistence.EntityManagerFactory
;
import
javax.persistence.EntityTransaction
;
import
javax.persistence.Persistence
;
import
com.wingnest.blueprints.impls.jpa.*
;
public
class
DogBreedTest
{
...
...
@@ -50,4 +52,34 @@ public class DogBreedTest {
emf
.
close
();
}
@Test
public
void
testJpa
()
{
//build the EntityManagerFactory as you would build in in Hibernate Core
EntityManagerFactory
emf
=
Persistence
.
createEntityManagerFactory
(
"ogm-jpa-tutorial"
);
//Persist entities the way you are used to in plain JPA
EntityManager
em
=
emf
.
createEntityManager
();
EntityTransaction
tm
=
em
.
getTransaction
();
tm
.
begin
();
Breed
collie
=
new
Breed
();
collie
.
setName
(
"Collie"
);
em
.
persist
(
collie
);
Dog
dina
=
new
Dog
();
dina
.
setName
(
"Dina"
);
dina
.
setBreed
(
collie
);
em
.
persist
(
dina
);
Long
dinaId
=
dina
.
getId
();
em
.
flush
();
em
.
close
();
tm
.
commit
();
final
JpaGraph
graph
=
new
JpaGraph
(
emf
);
graph
.
begin
();
final
Vertex
dinaVertex
=
graph
.
getVertex
(
dinaId
);
Assert
.
assertEquals
(
"Dina"
,
dinaVertex
.
getProperty
(
"name"
));
graph
.
commit
();
emf
.
close
();
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment