Posts

Showing posts from July, 2020

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 combinations among classes Adapter Making two interfaces which are incompatible compatible Facade Simplify the interactions with  too many working complex objects and complex interactions, something you want to call Hides complex behavior

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 Logical Exceptions      There are multiple ways to handle the ex