IBM / cloud-native-starter

Cloud Native Starter for Java/Jakarta EE based Microservices on Kubernetes and Istio
https://cloud-native-starter.mybluemix.net/
Apache License 2.0
518 stars 273 forks source link

Jakarta EE-fication of the articles MicroService #32

Closed AdamBien closed 4 years ago

AdamBien commented 4 years ago

The "articles" microservice was refactored and "optional" infrastructure code was removed. The focus was package structure and layering. Algorithms were not changed

nheidloff commented 4 years ago

Hi @AdamBien, this looks pretty good.

For some reason 'getmultiple' only returns one article. I'll look into it asap.

nheidloff commented 4 years ago

Hi @AdamBien, I've looked into your PR some more. Everything works like a charm, when I use JPA against a SQL database. However the in-memory path doesn't work anymore since every article gets the id "0" assigned: https://github.com/AdamBien/cloud-native-starter/blob/master/articles-java-jee/src/main/java/com/ibm/cns/articles/entity/Article.java#L22 As result only one article is returned when invoking "getmultiple".

You know certainly better how to fix this. Just as an idea, does it make sense to use an in-memory database like H2 instead of the current implementation so that JPA id assignments work?

The default behaviour in our documentation is to use the in-memory storage, which for example we use in the workshops. So I'd like to get this path working again. Your advice is appreciated!

nheidloff commented 4 years ago

I've merged and added a fix to assign unique ids for articles in the in-memory store.

nheidloff commented 4 years ago

Hi @AdamBien, shouldn't the ArticlesService be under 'control' rather than 'boundary'?