Sunday, December 11, 2022

spring boot membership application

 Spring Boot is a Java-based framework used to build web applications and services. It is built on top of the Spring framework and provides a simple and easy-to-use approach to creating stand-alone, production-grade Spring-based applications.

To create a Spring Boot application for a membership application, you would need to do the following:

  1. Install the Spring Boot framework and its dependencies on your system.

  2. Create a new project using the Spring Boot Initializer, which provides a starting point for your application.

  3. Define the dependencies for your project, such as Spring Web, Spring Data JPA, and H2 Database.

  4. Create a model class to represent a membership application, with fields such as name, email, and membership status.

  5. Create a repository interface to manage the persistence of membership application data, using Spring Data JPA.

  6. Create a controller class to handle HTTP requests related to membership applications, such as creating new applications, updating existing ones, and viewing a list of all applications.

  7. Use the Spring Boot Actuator to add monitoring and management endpoints to your application, such as a health check endpoint and a metrics endpoint.

  8. Configure the application properties to specify the details of the database, such as the URL, username, and password.

  9. Build and run the application using the mvn spring-boot:run command.

With these steps, you will have a basic Spring Boot application for managing membership applications. You can then customize and extend the application to add additional features and functionality as needed.


To create a model class for a membership application in Spring Boot, you would need to do the following:

  1. Create a new Java class and annotate it with @Entity to indicate that it is a JPA entity.

  2. Add fields to the class to represent the data you want to store for each membership application, such as name, email, and membership status.

  3. Annotate each field with @Column to specify the name of the corresponding column in the database table.

  4. Add a constructor to the class to initialize the fields with the provided data.

  5. Add getter and setter methods for each field to allow the data to be accessed and modified.

Here is an example of a model class for a membership application:

import jakarta.persistence.Column
import jakarta.persistence.Entity
import jakarta.persistence.GeneratedValue
import jakarta.persistence.Id
@Entity public class MembershipApplication { @Id @GeneratedValue private Long id; @Column(name = "name") private String name; @Column(name = "email") private String email; @Column(name = "membership_status") private String membershipStatus; public MembershipApplication() {} public MembershipApplication(String name, String email, String membershipStatus) { this.name = name; this.email = email; this.membershipStatus = membershipStatus; } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getMembershipStatus() { return membershipStatus; } public void setMembershipStatus(String membershipStatus) { this.membershipStatus = membershipStatus; } }

This class defines a MembershipApplication entity with fields for the name, email, and membership status of the applicant. It also provides getter and setter methods for these fields, as well as a constructor for creating a new instance of the class with the provided data.


To create a repository interface for managing the persistence of membership application data in Spring Boot, you would need to do the following:

  1. Create a new interface and extend it from the CrudRepository interface provided by Spring Data JPA.

  2. Specify the entity class and the type of the primary key field as the type parameters for CrudRepository.

  3. Define methods in the interface to perform various database operations, such as saving a new application, updating an existing one, or finding applications by name or email.

  4. Annotate each method with the appropriate JPA repository method, such as @Query or @Modifying, to specify the details of the database operation.

Here is an example of a repository interface for managing membership application data:

import org.springframework.data.jpa.repository.Modifying; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.CrudRepository; import org.springframework.transaction.annotation.Transactional; public interface MembershipApplicationRepository extends CrudRepository<MembershipApplication, Long> { @Transactional @Modifying @Query("update MembershipApplication a set a.membershipStatus = ?1 where a.id = ?2") int updateMembershipStatus(String membershipStatus, Long id); List<MembershipApplication> findByName(String name); List<MembershipApplication> findByEmail(String email); }

This repository interface defines methods for updating the membership status of an application and for finding applications by name or email. Each method is annotated with the appropriate JPA repository annotation to specify the details of the database operation.



To create a controller class for handling HTTP requests related to membership applications in Spring Boot, you would need to do the following:

  1. Create a new Java class and annotate it with @RestController. This indicates that the class is a Spring MVC controller and that it should handle HTTP requests.

  2. Inject an instance of the MembershipApplicationRepository interface into the controller using the @Autowired annotation. This will allow the controller to access the repository and perform database operations.

  3. Define methods in the controller to handle different types of HTTP requests, such as POST requests for creating new applications, PUT requests for updating existing ones, and GET requests for viewing a list of all applications.

  4. Annotate each method with the appropriate @RequestMapping annotation to specify the HTTP method and path that the method should handle.

Here is an example of a controller class for handling membership application requests:

import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @RestController @RequestMapping("/api/membership-applications") public class MembershipApplicationController { private final MembershipApplicationRepository repository; @Autowired public MembershipApplicationController(MembershipApplicationRepository repository) { this.repository = repository; } @GetMapping public List<MembershipApplication> getAllApplications() { return repository.findAll(); } @PostMapping public MembershipApplication createApplication(@RequestBody MembershipApplication application) { return repository.save(application); } @PutMapping("/{id}") public int updateApplication(@PathVariable("id") Long id, @RequestBody MembershipApplication application) { return repository.updateMembershipStatus(application.getMembershipStatus(), id); } }

This controller class defines methods for handling GET requests to view all applications, POST requests to create new applications, and PUT requests to update existing ones. Each method

Thursday, November 10, 2022

JSON Schema


json schema all data is accepted unless rejected

"$schema": - version of spec

"$id": "http://csfox.com/schema/object-record" URI namespace use with another

"type": object, OR "definitions":  { "$id" "#ID"

"properties": {

"type": "string",

"minlength": 1

object, null

additionalProperties: {

    "type": ["integer","string"],

    minLength: 1

schema6

https://app.quicktype.io/#|=schema


 method GET PUT 

path /update

params

headers - application/json

body payload

filter input controller  

action model

 escape output view




Wednesday, November 2, 2022

Wednesday, April 27, 2022

Postgres 14 MacOS App 2.5.6

 https://www.postgresql.org/download/macosx/

https://postgresapp.com/


  • sudo mkdir -p /etc/paths.d &&
    echo /Applications/Postgres.app/Contents/Versions/latest/bin | sudo tee /etc/paths.d/postgresapp

PostgreSQL with these default settings:

Hostlocalhost
Port5432
Useryour system user name
Databasesame as user
Passwordnone
Connection URLpostgresql://localhost

To connect with psql, double click a database. To connect directly from the command line, type psql. If you’d rather


SELECT datname FROM pg_database;

CREATE DATABASE hcyc;

\c hcyc

psql -U myuser -d mydb -a -f data.sql -W mypassword


To connect PostgreSQL to Hazelcast, you can use a middleware or a plugin which acts as a bridge between the two systems. There are several third-party libraries and tools available that can help you connect PostgreSQL and Hazelcast, such as:

  • Hazelcast IMDG Connectors: Hazelcast provides connectors that allow you to connect to various data sources including PostgreSQL. The connectors can be used to replicate data between PostgreSQL and Hazelcast, or to use Hazelcast as a caching layer for PostgreSQL.

  • JPA-Hazelcast: This is an open-source library that provides an implementation of the Java Persistence API (JPA) for Hazelcast. You can use it to map PostgreSQL tables to Hazelcast data structures, allowing you to query and manipulate data in both systems using JPA.

  • HA-JDBC: This is a JDBC driver that provides load balancing and failover for a variety of database systems including PostgreSQL. You can use it in conjunction with Hazelcast to provide high availability for PostgreSQL.



Friday, February 5, 2021

eclipselink

 install software eclipse latest JPA

user library

javax.persistence.Convert

jakarta

Tuesday, January 5, 2021

Oracle19c LogMiner

ORA-01325 archive log must be enabled


archive log - copy of redo log

delete of data

suspend archive on datapump



CL SCR

automatic log file slecction by specifying time frame timestamps

sqlplus -s 

SET LINESIZE 200;

alter session sset nlf_date_format = 'DD-MON-YYYY HH24:MI:SS';

ALTER DATATBASE ADD  SUPPLEMENTAL LOG DATA;

select supppliemental)log_data)min from V$DATABASE;


EXECUTE DBMS_LOGMNR.ADD_LOGFILE( -

    LOGFILENAME => 'PATH/fast_recovery_area/LGDB/archivelog/DATA/*.arc'. -

    options =>   DBMS_LOGMNR.NEW);>>


EXECUTE DBMS_LOGMNR.ADD_LOGFILE( 'path/redo1.log');


EXECUTE DBMS_LOGMNR.START_LOGMINER( -

        OPTIONS=>DBMS_LOGMNR.DICT_FROM_ONLLINE_CATALOG);

    STARTTIME => '01-Jan-2021 00:00:00', 

        ENDTIME =>


CONTINUOUS MINE IS GONE IN 19C

USE



DESC V$LOGMNR_CONTENETS

COLUMN X FORMAT A##;



SELECT OPERATION,USERNAME,OS_USENAME, SQL_REDO, TIMESTAMP FROM VS LOGMNR_CONTENTS;


DATA DICTIONARY USES UTL_FILE_DIR




localhost:1158/em

alter dataabae add suplimental log data(pirmary key) columns

alter system switch logfile; -- to force checkpoint



1. create init param on oracle db pointing to path \

init param can be pfile INIT.ora or spfile (server binary)

SHOW PARAMETERS UTL_FILE_DIR;

SHOW PARAMETERS 

Issue this command to display the parameter values that are currently in effect.

V$PARAMETER view

Query this view to display the parameter values that are currently in effect.

V$PARAMETER2 view

Query this view to display the parameter values that are currently in effect. The output from this view is the same, but more readable, than the output from the V$PARAMETER view.

V$SPPARAMETER view

Query this view to display the current contents of the server parameter file. The view returns null values if a server parameter file is not being used by the instance.

alter system set UTL_FILE_DIR = path


then us the DBMS_LOGMNR_D.build in plsql 



to build dd

EXECUTE DBMS_LOGMNR_D.BUILD('datadict.ora', -

    'utl_file_dir_loc', -

    DBMS_LOGMNR_D.store_in-flat_file;>>


EXECUTE DBMS_LOGMNR.START_LOGMNR( -

    DICTFILENAME => 'PATH/datadict.ora');>



https://grepora.com/2020/05/13/19c-could-not-execute-dbms_logmnr-start_logmnr-ora-44609-continous_mine-is-desupported-for-use-with-dbms_logmnr-start_logmnr/



LogMiner dictionary provide table/column names