Microservice development for full stack application with angularjs, spring boot by using jHipster

Hi Friends,

How easy is to create a micro service, put it behind a gateway and make it up and running as part of a full stack application ? Well its easier then it appears. I have published the video with live demo creating a micro service and making it full from a Angular UI by using aa awesome tool called jHipster. Watch it and have fun đŸ˜‰


Importance of flushing data in unit test cases

While writing unit tests it is a good practice to clear and flush the session. When application is executed in real time there are several request and response or different transactions due to which the session/cache gets cleared. However while running unit test, everything happens as the part of single process ie the session (especially hibernate) has rotten values or old references which gives some exceptions at times.

Exception :
org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session: [com.ptc.fusion.model.learningitem.OnlineCourse#1]
at org.hibernate.engine.StatefulPersistenceContext.checkUniqueness(StatefulPersistenceContext.java:613)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performUpdate

Code Example :



Map<FusionLocale, RootLearningItem> mapBeforeUnMapping = learningItemService.findEquivalentLearningItems(c2);
assert mapBeforeUnMapping.size() == 2;
assert mapBeforeUnMapping.values().contains(c1);
assert mapBeforeUnMapping.values().contains(c2);


boolean unMappingSuccessful = learningItemService.unMapEquivalentLearningItem(c1);
assert  unMappingSuccessful;

Hence it is always a good practice to clear/flush session after repository calls or hibernate transactions to make unit test case robust.


Debugging trick – Conditional break point

One of the most important developer activities is debugging.
Imagine there are 1000 employees in a record and application is giving error for a particular employee lets say with name “prem”. Console error says its some time inside the loop where all the records are iterated. Generally people put a break point  before the error prone line number and watches the value to find out the state. If its linear flow its good but if it is the loop then one has to wait for ( worst case 1000, best case within 10 ) repetition to get to know the root cause.

Here comes the experience of developer and facility of tool IDE which is called as conditional break point. By doing the right click on break point one can the property of conditional break point. you just need to simple give the condition ,as in if clause ->  emp.getName().equals(“prem”). By virtue of this condition the code will break only when the employee name is “prem”. This will save a lot of time to watch and analyze all the names of employees manually to find out the buggy/error prone employee object “prem”.

In such cases previously i use to do System.out.println(), recompile and run app time and again. then before check in the code need to remove systemouts. Now I realize it was such a pain and when better tricks are available đŸ˜‰

For more details to set conditional break point using Eclipse visit the below link: