Skip to main content

Posts

Collection Mapping Spring Data Jpa | JPA Collection Mapping

 Collection Mapping Spring Data Jpa For Explanation Watch Video: Directory Structure application.properties #datasource spring.datasource.url=jdbc:mysql://localhost:3306/new spring.datasource.username=root spring.datasource.password=root #jpa spring.jpa.hibernate.ddl-auto=create spring.jpa.show-sql=true spring.jpa.properties.hibernate.enable_lazy_load_no_trans=true SpringBootDataJpaCollectionMappingApplication  package com.app; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class SpringBootDataJpaCollectionMappingApplication { public static void main(String[] args) { SpringApplication.run(SpringBootDataJpaCollectionMappingApplication.class, args); } } Employee  package com.app.entity; import java.util.List; import java.util.Map; import java.util.Set; import javax.persistence.CollectionTable; import javax.persistence.Column; import javax.persistence.ElementCollecti...

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...

how to store html form data in mysql database using hibernate | Java Servlet and hibernate Example

  how to store html form data in mysql database using hibernate | Java Servlet and hibernate Example For Explanation watch video: Directory Structure Pom.xml <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.test</groupId> <artifactId>Servlet-Hibernate</artifactId> <packaging>war</packaging> <version>0.0.1-SNAPSHOT</version> <name>Servlet-Hibernate Maven Webapp</name> <url>http://maven.apache.org</url> <properties> <maven.compiler.source>1.9</maven.compiler.source> <maven.compiler.target>1.9</maven.compiler.target> </properties> <dependencies> <dependency> <groupId>junit</groupId...

Linux Shell - Arithmetic Operations solution

 Linux Shell - Arithmetic Operations solution for explanation watch video:: code:: read string res= $(echo "scale=4;$string" | bc) printf  "%.3f"   "$res"