Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hibernate OGM Infinispan Remote (Hot Rod) Demo #25

Closed
wants to merge 3 commits into from

Conversation

Projects
None yet
4 participants
@fax4ever
Copy link
Contributor

fax4ever commented Aug 23, 2017

No description provided.

@DavideD

This comment has been minimized.

Copy link
Member

DavideD commented Sep 8, 2017

Thanks @fax4ever, looks great.

I wonder if we should add some javadoc on top of the integration tests to describe the use case.
Normally I wouldn't, but this is a demo I suspect not everyone is used to this kind of tests.

WDYT?

@Sanne
Copy link
Member

Sanne left a comment

Great work! I didn't have time to actually run it so I started with some minor suggestions.

# Play Sport: Hibernate OGM (Infinispan Remote) Demo

Hibernate OGM can help write applications that interacts with a nosql database, avoiding writing a lot of "boilerplate code".
OGM is based on the JPA standard notation and it is integrated with JTA lifecycle.

This comment has been minimized.

Copy link
@Sanne

Sanne Sep 8, 2017

Member
  • remove "notation" ?
  • s/it is integrated with JTA lifecycle./it is integrated with the JTA lifecycle./
This demo is designed for Wildfly 10 JEE 7 container, but adding some dependencies it can work well as a standalone java application.
The next version will be tested for Openshift Container Platform.

In this demo, some simplifications are made, such as exposing directly Hibernate entities through Rest services.

This comment has been minimized.

Copy link
@Sanne

Sanne Sep 8, 2017

Member

s/In this demo, some /In this demo some /

This comment has been minimized.

Copy link
@Sanne

Sanne Sep 8, 2017

Member

s/Rest/REST/

The next version will be tested for Openshift Container Platform.

In this demo, some simplifications are made, such as exposing directly Hibernate entities through Rest services.
For more realistic production cases, you can use the framework as mapstruct (see http://mapstruct.org/) to easy translate entities into dtos and vice versa.

This comment has been minimized.

Copy link
@Sanne

Sanne Sep 8, 2017

Member
  • To be correct it should say /use the framework as mapstruct /use a framework like mapstruct /
  • dtos -> DTOs
  • Or you could simply remove the line? How to do it correctly is an opinion and not very related.

This comment has been minimized.

Copy link
@fax4ever

fax4ever Sep 11, 2017

Author Contributor

Yes you right, it is not very related. I take it away.

This comment has been minimized.

Copy link
@gunnarmorling

gunnarmorling Sep 11, 2017

Member

I actually like the reference to MapStruct ;)

This comment has been minimized.

Copy link
@fax4ever

fax4ever Sep 11, 2017

Author Contributor

I've done many projects with MapStruct and I love it so much. Many of our customers use it and are very happy.

```
the entire test infrastructure will be created and managed by the Arquillian framework (see http://arquillian.org/).

Our nosql data store here is Infinispan Server (see http://infinispan.org/docs/stable/server_guide/server_guide.html).

This comment has been minimized.

Copy link
@Sanne

Sanne Sep 8, 2017

Member

s/nosql/NoSQL/
s/here/in this example/


## Involved components

We need an Infinispan Remote Server and a Wildfly Application Server containing static modules of hibernate ogm and relative versions of hibernate orm, hibernate search and infinispan (hot rod) client.

This comment has been minimized.

Copy link
@Sanne

Sanne Sep 8, 2017

Member

Would be nice to be consistent with all the project names: capital letters. Hibernate OGM .. Hibernate ORM ... Hot Rod


private String name;

@Field(analyze= Analyze.NO)

This comment has been minimized.

Copy link
@Sanne

Sanne Sep 8, 2017

Member

some lack of consistency for the whitespace around "analyze=" ?

}

public List<Athlete> findAll() {
return em.createQuery("select c from Athlete c", Athlete.class).getResultList();

This comment has been minimized.

Copy link
@Sanne

Sanne Sep 8, 2017

Member

Does that work? I don't remember implementing queries for Hot Rod yet

This comment has been minimized.

Copy link
@fax4ever

fax4ever Sep 11, 2017

Author Contributor

It seems that it works well if the indexes are consistent with the entries of the caches. Using hibernate.search.default.directory_provider ram I never had any problems.

This comment has been minimized.

Copy link
@Sanne

Sanne Sep 11, 2017

Member

ah right, I forgot that all dialects can use the automatic translation form JPQL to Hibernate Search queries. FYI we still need to implement proper query capabilities for the Hot Rod dialect, so that it doesn't have to maintain local indexes.

*/
package org.hibernate.ogm.demo.playsport.rest.exception;

public class ExceptionDto {

This comment has been minimized.

Copy link
@Sanne

Sanne Sep 8, 2017

Member

Could you add some more javadoc to such helper classes? I'm not using REST very often so I'm not sure what these are for. I guess people studying the demo will want to understand this as well.

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

This comment has been minimized.

Copy link
@Sanne

Sanne Sep 8, 2017

Member

Is this file necessary?

@@ -0,0 +1,41 @@
Index: hibernate-ogm/playsport-demo/pom.xml
IDEA additional info:

This comment has been minimized.

Copy link
@Sanne

Sanne Sep 8, 2017

Member

What is this file for?

This comment has been minimized.

Copy link
@fax4ever

fax4ever Sep 11, 2017

Author Contributor

It is no longer necessary, I would only use the 5.2.0.Alpha tag. Ok?

@gunnarmorling

This comment has been minimized.

Copy link
Member

gunnarmorling commented Sep 11, 2017

Hi @fax4ever, great work! Very nice to see the new dialect. On the demo, does it focus on different aspects than the existing hike manager demo app (which also is an OGM-based REST application)?

@fax4ever

This comment has been minimized.

Copy link
Contributor Author

fax4ever commented Sep 11, 2017

Hi @gunnarmorling. Thank you. At the moment we only have the REST interface, in the next releases I would like to extend it by adding more interfaces and use cases.

@gunnarmorling

This comment has been minimized.

Copy link
Member

gunnarmorling commented Sep 11, 2017

(1) remove licence headers
(2) remove author headers
(3) remove Jackson annotations on Entities. Replace with MixIn classes.
(4) remove AthleteIT. PlaysportIT already cover the cases.
(5) remove beans.xml. JEE7 doesn't require it.
(6) add findAll on ClubEmployeeRepo
(7) change severity on some log (info -> debug)
(8) add javadoc on ExceptionDto (for clarifying its purpose)
(9) fix whitespace on Field annotation
(10) add javadoc on Arquillian test
(11) change OGM version to a tagged version: 5.2.0.Alpha1
(12) fix README file
@fax4ever

This comment has been minimized.

Copy link
Contributor Author

fax4ever commented Sep 11, 2017

Less code to maintain is always better. If you prefer and find it useful I can bring things done to the hike manager demo app, using the maven profiles we should be able to have a demo that works on both dialects.

@Sanne

This comment has been minimized.

Copy link
Member

Sanne commented Sep 20, 2017

We all agree that less code is better but let's also consider that this code exists now. We could simply merge it and agree that demos are only updated as we see fit, it doesn't necessarily imply more maintenance.

Also there's some value in keeping the projects relatively simple. When I had to create a Hot Rod based demo recently it was quite inconvenient that our base infrastructure is able to run so many different dialects, profiles, etc.. it does hinder readability.

@fax4ever

This comment has been minimized.

Copy link
Contributor Author

fax4ever commented Feb 23, 2018

Guys I'm going to close this old PR. I'm going to create a new one, a full working demo for Openshift / RHOAR platforms based on Hiberante OGM and Infinispan datastore

@fax4ever fax4ever closed this Feb 23, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.