Scheduler in Spring Boot with 3 Simple Steps Example

Scheduler in Spring Boot with 3 Simple Steps Example: Scheduler in spring boot became very simple and any one create a Cron job or scheduler in spring boot with just 3 steps. Step 1: Enable spring boot for schedules Add @EnableScheduling to your spring boot main class. @SpringBootApplication @EnableScheduling public class SpringBootStarter{ public static void main(String[] args) { SpringApplication.run(SpringBootStarter.class, args); }

224 total views, no views today

» Read more

Spring Boot + EhCache Hibernate Working Example

Spring Boot + Ehcache Hibernate Working Example: When I was trying to populate JSON records in my angular app (just 1885 records only), it took around 11 seconds and in angular side I am just populating in the datatable. So I thought to implement ehcache with spring boot to make it faster. After implementing that successfully I am really surprised

283 total views, no views today

» Read more

Join two tables using Hibernate in Spring Boot Example

Join two tables using Hibernate in Spring Boot Example: Many enterprise applications whichever using hibernate uses sql queries only for joins still and uses hibernate only for save/update operations. Today we are going to see how to use hibernate to join two tables. We are going to see how to get count(*) using hibernate along with group by function in

322 total views, no views today

» Read more

Spring Boot Native Query Example

Spring Boot Native Query Example: In Spring boot, database operations can be performed by implementing CrudRepository<Object, Long> in our @Repository interface. Here¬†Object is our entity class. @Query Annotation: We can execute nativeQueries using @Query annotation. Need to make the nativeQuery boolean to true and provide the native query to value parameter for @Query annotation.   Syntax: @Query(nativeQuery=true, value=”select s.store_name, s.store_url

239 total views, no views today

» Read more

Spring Boot with CriteriaBuilder for Dynamic Search Queries

Spring Boot with CriteriaBuilder for Dynamic Search Queries: Spring Boot with CriteriaBuilder for Dynamic Search Queries: When you are developing an enterprise application, you have to provide a search option dynamically with “and” condition. Our grand father way to do is using stringbuilder to construct the query in java and return the result. But hibernate has provided criteria for the

273 total views, no views today

» Read more

[Solved] The type CriteriaQuery is not generic;

[Solved] The type CriteriaQuery is not generic; It is because of the incorrect import. CriteriaQuery is available in both hibernate and persistence package. We have to import from persistence package in order to use criteriabuilder. CriteriaQuery should be imported from import javax.persistence.criteria.CriteriaQuery;   not from import org.hibernate.criterion.CriteriaQuery;   Sample snippet: @PersistenceContextprivate EntityManager em; CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriaQuery<AffiliateUrl> cq =

175 total views, no views today

» Read more

Angular 4 + Spring Boot CRUD Example

Angular 4 + Spring Boot CRUD ExampleAngular 4 + Spring Boot CRUD Example Angular 4 through Angular-CLI(command line interface) is becoming popular and with spring boot lot of projects started fresh developments and started their migrations to these technologies. What are we going to achieve: 1. Angular 4 UI 2. Spring boot rest API 3. CRUD(Create,read,update,delete) Operations. Requirements: 1. NPM

401 total views, 1 views today

» Read more

Difference between @Controller and @RestController

Difference between @Controller and @RestController: @Controller and @RestController is not having much difference, its just a matter of convenience to use @ResponseBody with @Controller. In simple way, we can understand like this: @RestController = @Controller + @ResponseBody     @Controller: @ResponseBody annotation should be used for RequestMapping methods to render any outputs like json/xml etc.   Code Sample: Here @ResponseBody

413 total views, 2 views today

» Read more

Spring Boot Hello World Step by Step

Spring Boot Hello World Step by Step: Spring boot is a brand new framework provides opinionated approach for basic configurations and helping developers to directly dig into business logics. Just follow this tutorial, you will understand better after creating the first hello world spring boot application.   Prerequisite: Spring STS Eclipse Tool   Video Tutorial: Step 1: Create spring starter

277 total views, no views today

» Read more

Spring Boot + Rest Controller Simple Demo

Spring boot is becoming familiar along with angular. spring boot can be used for standalone and batch projects. In Angular it is used for backend with rest controllers. So knowing how to use spring boot with rest controller will be very helpful for angular backend java developments. Prerequisite: Spring STS Tool If you dont have you can download and install

434 total views, no views today

» Read more