Skip to content

Instantly share code, notes, and snippets.

1. JPA Java Persistence API provides a specification for persisting, reading and managing data from your java object to relational tables in database
2. Hibernate is an object ralational mapping solution for java enviroments. ORM is a programming technique to map application domain model objects to relational database tables;
Hibernate provides a reference implementation of Java Persistence API that make it a greate choice as ORM tools with benefit of loose coupling.
Note that JPA is a specification and Hibernate is a JPA provider of implementation.
3. Spring Data is a part of the Spring Framework. The goal of Spring Data repository abstraction is reduce amount of
boilerplate code requited to implement data access layer.
1. jpa-entity-class
- @javax.persistance.Entity
- public, protected no-argument contructor
- class not declare final, no method, persistence instance variables is final.
- if an entity is passed by value as detached object. such as through a session bean remote. class must by implementaion Serialization
- Entity may extends both entity and non-entity class.
- fields: not annotated
SessionFactory
Session
Transaction
ConnectionProvider
Transaction Factory
1. http://62.4.19.189:8090/spaces/viewspace.action?key=MAN dtrantri/12345678
2 gitlab
tledang/tuan1989
3. jenkins
http://62.4.19.164:8080/login?from=%2F
tledang/12345678
4. dev enviroment
@ledangtuanbk
ledangtuanbk / check cors online
Created September 20, 2019 01:40
check cors online
1. go to page with http
2. in console run this command to check
fetch('./api/some.json')
.then(
function(response) {
if (response.status !== 200) {
console.log('Looks like there was a problem. Status Code: ' +
response.status);
return;
https://phoenixnap.com/kb/how-to-setup-ftp-server-install-vsftpd-centos-7
create file /etc/vsftpd/chroot_list
add testuser to this file
1. view ssl certificate text
openssl x509 -in cerfile.cer -noout -text
2. create private key and cert file
openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365
3. Generate a self-signed certificate
openssl req -x509 -sha256 -nodes -days 365 -newkey rsa:2048 -keyout privateKey.key -out certificate.crt
https://www.sslshopper.com/article-most-common-openssl-commands.html
check application use by port
sudo lsof -P -i -n|grep '80.*LISTEN'
1. View dependency:tree
mvn dependency:tree
2. install jar to localhost
mvn install:install-file -Dfile=/home/ldt/Downloads/hitutils.jar -DgroupId=com.ldt -DartifactId=hit -Dversion=1.0 -Dpackaging=jar
3. install jar file to nexus repository
mvn deploy:deploy-file -DgroupId=com.ldt \
-DartifactId=hit \
-Dversion=1.0 \
@ledangtuanbk
ledangtuanbk / gist:9d933bac97c794638456e4fe136958c5
Created October 28, 2019 08:01
Install load_balancing mariadb 10.4
- precondition
1. Turn off firewalld
2. Disable selinux
following this guide
https://www.digitalocean.com/community/tutorials/how-to-configure-a-galera-cluster-with-mariadb-on-centos-7-servers#step-6-%E2%80%94-creating-a-selinux-policy
cai haproxy
https://www.datadoghq.com/blog/how-to-collect-haproxy-metrics/