[OGM] MongoDB JPQL Query: comparison with object fails
by Guillaume SCHEIBEL
Hello,
I found an problem with the MongoDBComparisonPredicate. When I try to make
a jpql query with an object comparison [1]
The value (here a SolutionType instance) is "directly" passed to the
MongoDBComparisonPredicate which tries to use it as it is, in a DBObject
query.
The point is, the refering property is solutionType_id (which is correct)
but instead of using the parameter id, it's using the complete object [2]
The MongoDB drivers returns that it can't serialize the type passed in
parameter..
There is something I don't get, why for basic CRUD operations do we use
dehydrated object and for queries as well ? Object parameter (all paramater
that are not String, or wrappers) would be easier to use.
WDYT ?
Guillaume
[1] https://gist.github.com/gscheibel/7070143
[2]
https://github.com/hibernate/hibernate-ogm/blob/master/mongodb/src/main/j...
10 years, 6 months
[OGM] JPQL support
by Guillaume SCHEIBEL
Hello,
I can confirm that JPQL queries are only working if they are executed from
a org.hibernate.Session. If we want to run them from the entity manager, we
get a OGM-21 thrown from the OgmEntityManager.createQuery(String query)
method.
How can wa / I make it work ?
Thanks
Guillaume
10 years, 6 months
[OGM] Integration test
by Guillaume SCHEIBEL
Hello,
I'm writing a quick sample application using OGM. In this application I'm
using a JP-QL query
"From DatabaseVendor d"
this query is executed by the EntityManager therefore I get an OGM21
exception. So I wrote a unit test to exclude the query parser and it
passed. Then I'm trying to reproduce the error with an integration test.
I have:
- enhanced the ModuleMenberRegistrationScenario,
- copied my Jboss7.1.1 as integrationtest/mongodb/target/jboss-eap-6.1
When I'm running the tests, (the MONGODB_HOSTNAME, and MONGODB_PORT set),
the server is starting, it's creating the archive to deploy and nothing.
The console doesn't show any deployement of the test-archive.
And then nothing ... it seems the server (or something else) is waiting for
something to happen, but what ?
I've created a gist: https://gist.github.com/gscheibel/7060445 with the
server log.
Any thought ?
Thanks
Guillaume
10 years, 6 months
[OGM] support for remote grids
by Sanne Grinovero
Hi all,
it looks like I will be very busy on Search and some more Infinispan
integrations in the coming couple of months, but there are some very
exciting things that I would love to see in OGM soon, and since I
heard there is a lot of excited people out there waiting for this too,
this is your chance to grab some more glory.
As you know we have several GridDialects, one of the first one was
supporting Infinispan but only in "embedded mode".
Embedded mode was the first choice because it's easier, and also because:
- it supports transactions
- had some form of query capability (although we never used it)
- lowest latency, assuming your data set is reasonable
But people looking at OGM are especially fascinated by the idea to use
it in a more traditional architecture, which implies having a
"database" as a separate independent service.
Infinispan 6.0 is almost ready, and thanks to Gunnar includes a bit of
OGM in its DNA to support queries defined from a remote client (Hot
Rod client).
I think it would be terrific if someone could start hacking on a
HotRodDialect, and start writing tests to stress this new query
capability; specifically I had the Gunnar - Davide team in mind if
they can :-)
We'll have to ignore transactions for now, I guess it could be
considered like we do with MongoDB: make it clear the backend is not
transactional in the docs.
Timing-wise, if we could have a prototype using HQL queries very very
soon, that would be a great help to the Infinispan team as it would
validate the new feature; this idea of mine is probably too late as
Infinispan is already at CR2 phase (tomorrow) but you might be able to
put some basic checks in place on time?
Second priority - also relatively urgent - is to move on to latest ORM
version, so that possible complexities can be softened in ORM before
4.3 is declared Final.. it's still using the outdatet 4.2.0.CR1 !?
We should get it to work on WildFly quickly.
Sanne
10 years, 6 months
generated code in hibernate
by Jonathan Bernwieser
Hi there,
I am currently doing my Bachelor thesis at TU Munich, at the Software
Engineering chair of Prof. Broy.
The goal of this thesis is to create a tool to automatically categorize
source code in open source software. Different categories will be "test
code", "generated code" and "productive code" to better evaluate and use the
results of quality-check techniques. (Static analyses might detect certain
quality problems even though they're not relevant for a certain code
category. One example would be the amount of clones found in a project. It
has to be checked what kind of category the evaluated code belongs to as
clones aren't causing quality issues if they occur in "generated code".)
In order to create and test heuristics to identify code categories, I first
need to create manually a collection of different projects (or classes to be
more specific) I actually know about what kind of category they belong to.
While manually going through the hibernate project I couldn't find any files
that were automatically generated. Is that correct or are there any
generated classes I didn't recognize?
Thanks you for your help.
Looking forward to hearing from you,
Regards,
Jonathan
10 years, 6 months
[OGM] Neo4J discussions
by Emmanuel Bernard
Davide and I had an interesting discussion on OxM and Neo4J with
Nicolas. We also brushed on the JCA support and lack of Neo4J interest
in it.
This is a dump of the conversation and a way to continue the
conversation in the open.
## JCA support
Provided outside of Neo4J's team help.
Original author has unplugged from the internet.
## Blueprints
Nicolas, recommended us to look at Blueprints which offers an
abstraction over Neo4J APIs with clearer concepts. Blueprints is
implemented for other Graph databases so we would gain support for them
too for "free".
https://github.com/tinkerpop/blueprints/wiki
Davide looked at it and our use of Neo4J seems simple enough that we
could switch to Blueprints easily.
## Mapping model
We discuss the various mapping modeling strategies to represent an
object graph in a GraphDB.
### Hibernate OGM's approach (aka classic)
An entity is mapped as a node. A property is added to save the name of the
table that maps the entity.
Attributes of the entity are mapped as properties.
A unidirectional association is mapped as a neo4j Relationship where the
starting node is the owner of the relationship. The type of the
relationship is the name of the association.
A bidirectional association is mapped using two relationships, one for each
direction.
A sequence is stored in a node with the value stored in a property, Every
time we need to update the value of the sequence we acquire a lock on the
node.
Node and relationships are stored into two separate lucene indexes and when
I need to retrieve them I use a lucene query.
I've developed the code using Neo4j 1.9.4 (I'm now moving to Neo4j 2)
### Gaedo (aka vertex per property)
Each element (be it a model
entity or one of its property) was mapped directly as a node in graph.
Look here for more infos :
http://riduidel.github.io/gaedo/site/0.4.21/gaedo-blueprints/1_gaedo_grap...
The main advantage of this approach is that we do not have to browse
(and maintain) an index to find objects for which the property "name"
has the value "foo". instead, we directly locate the vertex holding
that value, then back-navigate the links named "name" to find objects
..; well, I guess you can see the advantage of this approach.
Which takes me back to that divide between properties stored as
properties of vertex, or as distant vertices.
Each approach has its advantage :
- one vertex per literal ensures easy search through graph navigation
languages (be them gremlin, cypher, or any other one you find) and
some nice-to-architect similarity for all vertices (in my case, each
graph vertex has two properties mimicking the ones found in RDF
concepts : kind and value). The cost of it being easier lock (it
indeed seems neo4j requires a lock on each vertex when adding/removing
an edge connecting them)
- one property per literal avoids those locking issues, but obviously
make search really dependant upon indices, and furthermore impossible
to write using "pure" graph query language,a s queries will sometimes
rely upon indices navigation, and sometimes upon graph navigation,
which maybe hard to differentiate - or maybe not.
### Mapping conclusion
After a few back and forth we concluded that the vertex per property
approach does not offer much advantages including in query performances.
Quite the contrary, there are a few advantages to the classic and
natural approach like lower deadlock rate, possibly faster queries etc).
So we will start with this approach in Hibernate OGM and see where it
leads us.
### Data points
Some info on the Neo4J storage
http://digitalstain.blogspot.fr/2011/11/rooting-out-redundancy-new-neo4j....
## Id generators
I would be nice to implement a generator that uses Neo4J's internal id
property generated for each node. While it is not monotonic, it is a
viable id generator option.
Note that seuqnce mapping still requires to store the sequence seed and
using the Neo4J id property won't be of help here.
That's a condensed version of the discussion. We can continue from there
if needed.
Emmanuel
10 years, 6 months