Posts

Hibernate Interview Questions

1. What are the main classes of  Hibernate Session SessionFactory Criteria Query Transaction 2. Lazy loading vs Eager Loading 3. Why is second-level caching not enabled by default? The second Level cache is disabled by default because the configuration and choice of which entities are cacheable is application-specific. In JPA, you can turn on cache for a particular domain with annotation @Cacheable

Java Spring Interview Questions

Java Spring Interview Questions 1. Have you used any Docker? 2. Suppose there is a requirement that for every call we need to create a new instance, how can that be done in Spring Boog Answer - using Spring bean with Scope as Prototype and then every time you need a bean, get the SpringApplicationContext and call ctx.getBean() 3. When a REST API POST call is made, how is that converted to Java objects to work in your controller or service layer Answer - Spring offers ViewResolvers, you can use JSONResolver to convert the JSON inputs to a Java Bean which then can be consumed by Controllers 4. How can you achieve Auto Scaling in kubernetes 5. Have you worked in Hibernate JPA or Spring JDBC in your projects? Answer - both , while Hibernate JPA is good for queries, there are some queries where its not efficient enough and you need to have SQLs itself, like if you want to do a bulk update 6. Explain the process of having your Spring WAR deployed on Kubernetes Cluster? 7. Explain how JWT Aut...

Design Patterns

Image
Design Patterns are nothing but proven solutions to recurring problems. 1. Some favorite design patterns      Creational Patterns         - Prototype              - used to create objects by cloning other objects                             - Factory         - Singleton      Structural Design Patterns       They show how the objects are composed, is there an inheritance between them, or is one object composed in another object, interfaces present Proxy Pattern                        e.g credit card is the proxy of the Bank Account Decorator Adds more functionality without opening the object Wraps the decorator another class, it is a component and has a component Advantage - allows you to have multiple combi...

NodeJs Interview Questions

Image
Node.js has over 450K modules as of this writing, and is one of the popular frameworks for fast and robust frameworks. Typically they are implemented with microservices. Below are some NodeJs interview questions, you need to prepare 1. Have you incurred any memory leak issues in Node.js memory leaks occur where there are short lived objects assoicated with a long term object e.g  const req = new Map() app.get("/", (req,res_ => {   request.set(req.id, req)   res.send(200).send("hello world") }             Identify it using Sample Heap Profiler.           For more info refer 2. Explain what is Exception Handling you used in Node.js     Node.js exception handling is different than traditional Java based exception handling, there are multiple ways exception can be handled based on the need.     Overall there are two types of Exception System Exceptions...

Rails Goodness: bundle exec when Ruby versions mismatch errors

Rails is sometiems wierd, it complains that the ruby version you are running is different than what is specified in Gemfile. But when I see the version, using $ ruby -v, it all looks good. Only solution is to force rails to look for ruby version, inside the directory you are working on, and the way to do it is, using bundle exec, like so   » RAILS_ENV=development bundle exec rake app:run   Thank you!!

Git: How to generate a diff file in git

Tools like reviewboard, allow you the generate code reviews, although they have a rbt tool to generate the code review with diff, sometimes there is a need to generate this diff file manually and upload it, Below command  $  git show --full-index > ~/mytest.diff will generate the diff file which you can use for the same

Git: How to Squash your commits into one commit before merging

When you are doing a feature development, typically there are many local commits which happen, its always a good idea that squash all those commits into one commit and then merge them to the master branch. Below are the steps to do the same #Step1 : Start git rebase in interactive mode $ git rebase -i master #once you do this, you will all your commits in an editor likewise pick 1b6f7fed87 feature1 pick 1b6f7fed85 old commit1 pick 1b6f7fed83 old commit2 pick 1b6f7fed81 old commit3 # Rebase 806f77feab..1b6f7fed87 onto 806f77feab (1 command) # # Commands: # p, pick = use commit # r, reword = use commit, but edit the commit message # e, edit = use commit, but stop for amending # s, squash = use commit, but meld into previous commit # f, fixup = like "squash", but discard this commit's log message # x, exec = run command (the rest of the line) using shell # d, drop = remove commit # # These lines can be re-ordered; they are executed from top to bottom. # # If you remove...