Skip to main content

Posts

Showing posts from March, 2022

spring boot data jpa custom finder methods

 spring boot data jpa finder methods For explanation Watch video : Directory Structure dependencies:: lombok Spring data JPA Mysql Driver application.properties #datasource properties spring.datasource.url=jdbc:mysql://localhost:3306/new spring.datasource.username=root spring.datasource.password=root #jpa spring.jpa.hibernate.ddl-auto=update spring.jpa.show-sql=true SpringBootDataJpaFinderApplication  package com.app; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class SpringBootDataJpaFinderApplication { public static void main(String[] args) { SpringApplication.run(SpringBootDataJpaFinderApplication.class, args); } } Employee.java package com.app.model; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; import ...

Custom Non-Select Queries with Spring Data JPA’s @Query , @Modifying , @Transactional Annotations

 Custom Non-Select Queries with Spring Data JPA’s @Query , @Modifying , @Transactional Annotations For Explanation watch video: Directory Structure application.properties #datasource properties spring.datasource.url=jdbc:mysql://localhost:3306/new spring.datasource.username=root spring.datasource.password=root #jpa  spring.jpa.show-sql=true spring.jpa.hibernate.ddl-auto=update SpringBootDataJpaNonSelectApplication package com.app; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class SpringBootDataJpaNonSelectApplication { public static void main(String[] args) { SpringApplication.run(SpringBootDataJpaNonSelectApplication.class, args); } } Employee.java package com.app.model; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persist...

how to create rest api using spring boot in eclipse

 how to create rest api using spring boot in eclipse For Explanation Watch Video: Directory: application.properties:: #server port server.port=3031 #datasource spring.datasource.url=jdbc:mysql://localhost:3306/new spring.datasource.username=root spring.datasource.password=root #jpa spring.jpa.show-sql=true spring.jpa.hibernate.ddl-auto=create SpringBootRestApplication  package com.app; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class SpringBootRestApplication { public static void main(String[] args) { SpringApplication.run(SpringBootRestApplication.class, args); } } StudentController  package com.app.controller; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.DeleteMapping; import org.s...

C Program

 #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <pthread.h> int SIZE=50000; int TAIL; int HEAD; pid_t MYARRAY[50000]; pthread_mutex_t mutex; pthread_cond_t condInserted; pthread_cond_t condRemoved; int isFull(){ if((HEAD+1)%SIZE==TAIL){ return 1; } return 0; } int isEmpty(){ if(HEAD==TAIL){ return 1; } return 0; } void * thread1(){ while(1){ pthread_mutex_lock(&mutex);//mutex object referenced by mutex shall be locked if(isFull()){ printf("Full queue"); pthread_cond_wait(&condRemoved,&mutex); } pid_t tid = gettid(); HEAD = (HEAD+1)%SIZE; MYARRAY[HEAD] = tid; printf("\nWriter:%d\n",tid); pthread_mutex_unlock(&mutex);//mutex object referenced by mutex  be unlocked pthread_cond_signal(&condInserted);//call unblocks at least one of the threads that are blocked on the specified condition variable cond usleep(300000); } } void* thread2(){ while...