Reading and Writing Object Using ObjectMapper

We can use it to parse or deserialize JSON content into a Java object.

Java Object to JSON

ObjectMapper objectMapper = new ObjectMapper(); Car car = new Car(“yellow”, “renault”); objectMapper.writeValue(new File(“target/car.json”), car);

JSON to Java Object

String json = "{ \"color\" : \"Black\", \"type\" : \"BMW\" }";
Car car = objectMapper.readValue(json, Car.class);

The readValue() function also accepts other forms of input, such as a file containing JSON string:

Car car = objectMapper.readValue(new File("src/test/resources/json_car.json"), Car.class);

Transaction simply represents a unit of work ,In such case, if one step fails, the whole transaction fails.

Hibernate Transaction Management

Transaction simply represents a unit of work ,In such case, if one step fails, the whole transaction fails.

Transaction is a Interface in Hibernate

  • The methods of Transaction interface are as follows:
    * void begin() starts a new transaction.
    * void commit() ends the unit of work unless we are in FlushMode.NEVER.
    *…

Export table in csv file By Using mysql command

SHOW VARIABLES LIKE “secure_file_priv”;
SELECT * FROM bootapplication into outfile ‘/ProgramData/MySQL/MySQL Server 8.0/Uploads/mysql_processes.csv’;

Export table in csv file by using workbench

Step1-

Step 2-

Step 1 — Run your Spring boot application
Step 2 -http://localhost:9001/h2-console/
port no- Application port no (9001)
Step 3- JDBC URL ,username and password application.yml or properties file

H2 Console on browser
H2 console
application.ymlserver:
port: 9001
spring:
application:
name: product-services
datasource:
driver-class-name: org.h2.Driver
password: password
url: "jdbc:h2:file:~/products;AUTO_SERVER=true"
username: root
h2:
console:
enabled: true
jpa:
databae-platform: org.hibernate.dialect.H2DDialect
hibernate:
ddl-auto: update