Open in app

Sign In

Write

Sign In

Sanjay Singh
Sanjay Singh

55 Followers

Home

About

Dec 18, 2022

How to write junit test case with mokito for spring boot.

controller ,service, and repository and DTO JaCoCo for Java Code Coverage with exclude some package pom.xml <?xml version="1.0" encoding="UTF-8"?> <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/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.netapp.spa</groupId> <artifactId>spa-svc</artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>jar</packaging> <name>spa-svc</name> <description>SPA Service</description> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.7.4</version> <relativePath /> <!-- lookup parent from repository --> </parent> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <java.version>11</java.version> <finalName>${project.artifactId}-${project.version}</finalName>…

Spring Boot

4 min read

Spring Boot

4 min read


Nov 18, 2022

How To call procedure in JPA

package com.hays.career.common.repository; import com.hays.career.common.entity.UserApplication; import org.springframework.data.domain.Pageable; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Modifying; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.query.Param; import org.springframework.stereotype.Repository; import javax.transaction.Transactional; import java.util.List; @Repository public interface UserApplicationRepository extends JpaRepository<UserApplication, Integer> { @Transactional @Query(nativeQuery = true, value = "call online_audit_master.proc_hc_ad_user_application(:p_user_email,:p_workflow_type,:p_job_id,:p_s3_userdata_url,:p_s3_userdoc_url,:p_domain)") UserApplication procHcAdUserApplication(@Param("p_user_email") String p_user_email, @Param("p_workflow_type") String p_workflow_type…

Jpa

1 min read

Jpa

1 min read


Oct 31, 2022

Why JPA Entity or Hibernate Persistence Class Should Not be Final?

Yes, a Hibernate Entity class can be declared final, however it is not a good practice. Hibernate uses the proxy pattern for performance improvement during lazy association, by making an entity final, Hibernate will no longer be able to use a proxy as Java doesn’t allow the final class to…

Java 8

1 min read

Java 8

1 min read

Why JPA Entity or Hibernate Persistence Class Should Not be Final?

Yes, a Hibernate Entity class can be declared final, however it is not a good practice.

Hibernate uses the proxy pattern for performance improvement during lazy association, by making an entity final, Hibernate will no longer be able to use a proxy as Java doesn’t allow the final class to…

--

--


Oct 31, 2022

Data Base

How to TRUNCATE table if FK added in table ? — SET FOREIGN_KEY_CHECKS = 0; TRUNCATE table online_audit_master.hc_ad_user_application; SET FOREIGN_KEY_CHECKS = 1;

Database

1 min read

Database

1 min read

Data Base

How to TRUNCATE table if FK added in table ?

SET FOREIGN_KEY_CHECKS = 0;
TRUNCATE table online_audit_master.hc_ad_user_application;
SET FOREIGN_KEY_CHECKS = 1;

--

--


Oct 31, 2022

JMS Example

JMS (Java Message Service) is an API that provides the facility to create, send and read messages. It provides loosely coupled, reliable and asynchronous communication Advantage of JMS 1) Asynchronous: To receive the message, client is not required to send request. Message will arrive automatically to the client. 2) Reliable: It provides…

Java

2 min read

Java

2 min read


Oct 31, 2022

When you run Kafka getting issue on windows

set the path

Java 8

1 min read

When you run Kafka getting issue on windows
When you run Kafka getting issue on windows
Java 8

1 min read

When you run Kafka getting issue on windows

set the path

--

--


Sep 13, 2022

Run Spring boot project at command line

Run Spring boot project at command line java -jar target/onlinebookstore-0.0.1-SNAPSHOT.jar

Java

1 min read

Java

1 min read

Run Spring boot project at command line

Run Spring boot project at command line

java -jar target/onlinebookstore-0.0.1-SNAPSHOT.jar

--

--


Sep 13, 2022

Difference between sleep() and wait() in Java

sleep() is a method which is used to pause the process for few seconds or the time we want to. But in case of wait() method, thread goes in waiting state and it won’t come back automatically until we call the notify() or notifyAll(). The major difference is that wait()…

1 min read

1 min read


May 21, 2022

Interview Question Based On String

1-Reverse the String in java public class Testing { public static String getRevrse(String name) { String rev = “”; for (int i = name.length() — 1; i >= 0; i — ) { rev = rev + name.charAt(i); } return rev; } public static void main(String[] args) { String name…

Java Interview Questions

1 min read

Java Interview Questions

1 min read


May 21, 2022

Reverse an array upto a given position

1 2 3 4 5 6 7 8 9 o/p 4 3 2 1 5 6 7 8 9 public class Application { public static void main(String[] args) { Integer[] x = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; int length = x.length; int pos = 4…

Java

1 min read

Java

1 min read

Reverse an array upto a given position

1 2 3 4 5 6 7 8 9
o/p
4 3 2 1 5 6 7 8 9

public class Application {
public static void main(String[] args) {
Integer[] x = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
int length = x.length;
int pos = 4…

--

--

Sanjay Singh

Sanjay Singh

55 Followers

Java||Spring-Boot|| Micro services Application developer|| INDIA

Following
  • Amar Balu

    Amar Balu

  • Netflix Technology Blog

    Netflix Technology Blog

  • Sanjay Y

    Sanjay Y

  • Kevin Tomas

    Kevin Tomas

  • Furkan Danışmaz

    Furkan Danışmaz

Help

Status

Writers

Blog

Careers

Privacy

Terms

About

Text to speech