Win a copy of Get Programming with Java (MEAP only) this week in the Beginning Java forum!

Rashmi Deshpande

Greenhorn
+ Follow
since Nov 08, 2013
Rashmi likes ...
Eclipse IDE Java Tomcat Server
Can't say novice, but always a learner.
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
Received in last 30 days
0
Total given
12
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Rashmi Deshpande

Hello to the experts and authors of the Microservices in Action book:

Congratulations on your book launch, couldn't be a good time than now to ask a few questions pertaining to what the book title speaks for:

Currently, there seems to be a sudden boom & hype about the newest architectural style for designing modular and real-time applications, e.g: Netflix, being the most popular one.

As a novice to microservices, who has less information about this new architectural style, I have a few questions:

1.) When should one determine the need for adopting microservices architecture?

2.) Does security come at stake when we consider several small(not necessarily small) components talking to each other?
   Because in the typical monolithic architecture style, the security is application wide bounded; in Microservices case, do we need to enforce security to all the 'n' components involved?
   If yes, then how is the redundancy of writing security code managed? Suppose a banking application which needs to be highly secure at all levels?

3.) What care should be taken when transforming a monolithically developed application running for a couple of years to a microservices architecture? Should the entire wheel be re-invented? Or can we re-use the   existing parts whilst designing?

Looking forward to your answers on these and the book as well.

Thank you!

P.S. Please forgive me if my questions are too naive or vague in any way.
1 month ago
Respected Authors

Thank you for yet another informative book on Java, really looking forward to get the book in hand and clear my concepts.
P.S: Hoping to win this book ;-)

Thanks
Sheetal Deshpande
So after almost a month's wait I was finally able to derive this conclusion proposed as an answer to my own question with the help from various sources:

1.) When using dynamic-update, Hibernate has to generate the corresponding SQL string each time and there is thus a performance cost on the Hibernate side. In other words, there is a trade-off between overhead on the database side and on the Hibernate side.

2.) Hibernate caches the actual SELECT, INSERT and UPDATE SQL strings for each entity. This results in not having to re-create these statements every time you want to find, persist or update an entity.However, when using dynamic-update, Hibernate has to generate the corresponding SQL strings each time. This results in a performance cost on the Hibernate side.

3.) Useful when applied to a very small & simple table as there is a significant performance gain using this annotation. A more realistic scenario, on wider tables using a remote database, performance increases may be more pronounced. Of course, the mileage you get out of this will vary most of the columns need to be updated.

4.) The @DynamicUpdate annotation/ dynamic-update=true is used to specify that the UPDATE SQL statement should be generated whenever an entity is modified. By default, Hibernate uses a cached UPDATE statement that sets all table columns. When the entity is annotated with the @DynamicUpdate annotation, the PreparedStatement is going to include only the columns whose values have been changed.

Overall could be summarized as:

1. Runtime SQL generation overhead.
2. No PreparedStatement(caching) used anymore.
3. Performance overhead.

Credits: Hibernate ORM 5.2.7.Final User Guide,http://memorynotfound.com/hibernate-dynamic-update-attriburte-example/,http://stackoverflow.com/a/3405560/1004631

P.S.: Also holds true for dynamic-insert=true/ @DynamicInsert annotation
1 year ago
So I understand what setting this attribute dynamic-update=true does, i.e it considers only those fields that were modified and omits the job of setting null values for other fields. Saving an overhead, good on performance.

Asking out of curiosity: How does hibernate come to know what all fields were modified? Does it do a comparison of the result generated by the select query to the database first before firing an update query? Assuming yes, then isn't comparison an overhead to performance?

Correct me if I'm wrong. Thanks in advance!
1 year ago
Was facing the same issue for almost a day long. When deep introspected found that it was because I had a typo basically, used session.clear() in the finally block instead of session.close(). Hope this helps.
2 years ago
I have an input string of the format dd/MM/yyyy, I need to convert it into date dd/MM/yyyy.

My approach is:

SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy");
String date = formatter.format(formatter.parse("22/09/2016"));
Date convertedDate = formatter.parse(date);
I was expecting 22/09/2016 as a date object, however the format returned was not as expected. Output=>Mon Sep 12 00:00:00 IST 2016

Any idea where I am going wrong? Thanks in advance!

2 years ago