This article is about improving JPA’s performance when working with large/thick hierarchies. Let’s suppose that for some reason you have a similar (or larger) hierarchy to one I encountered in one of my projects: – InheritanceType.JOINED also using DiscriminatorColumn – […]
Database
Java hibernate
How to mix inheritance strategies with JPA annotations and Hibernate? http://stackoverflow.com/questions/3915026/how-to-mix-inheritance-strategies-with-jpa-annotations-and-hibernate use @SecondaryTable for joined table
Ubuntu and Oracle
# see also https://wiki.centos.org/HowTos/Oracle12onCentos7 # see also https://adrhc.go.ro/wordpress/centos-and-oracle/ # Follow this (works with Ubuntu 16.04 too): # http://www.techienote.com/install-oracle-12c-on-ubuntu/ # systemd oracle.service (working when only one db is automatically started with /etc/oratab) [Unit] Description=Oracle 12c After=local-fs.target Wants=local-fs.target [Service] Type=forking User=oracle Group=oinstall […]
JPA performance
http://java-persistence-performance.blogspot.ro/2011/06/how-to-improve-jpa-performance-by-1825.html# http://spitballer.blogspot.ro/2010/04/jpa-persisting-vs-merging-entites.html Use byte code weaving EclipseLink implements LAZY for OneToOne and ManyToOne relationships using byte code weaving Pagination Use setFirstResult, setMaxResults of javax.persistence.Query. Caching See https://docs.oracle.com/javaee/7/tutorial/persistence-cache001.htm#GKJIO. See <shared-cache-mode> in persistence.xml or javax.persistence.sharedCache.mode property when creating the EntityManagerFactory. See javax.persistence.Cacheable […]
@MapKey vs @MapKeyColumn
// @MapKey refers the field/property (unique one) in the Entity witch is the value of a Map field/property // @MapKeyColumn refers the column in an @ElementCollection @Entity public class Person6 { @OneToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL, orphanRemoval = true, […]
Ubuntu: phpMyAdmin setup
wget https://files.phpmyadmin.net/phpMyAdmin/4.5.0.2/phpMyAdmin-4.5.0.2-english.tar.gz tar xvzf phpMyAdmin-4.5.0.2-english.tar.gz mv phpMyAdmin-4.5.0.2-english myadmin mkdir myadmin/config chown -R ************ myadmin/config /etc/php5/fpm/php.ini session.gc_maxlifetime = 3600 sudo service php5-fpm restart #save configuration created using https://adrhc.go.ro/myadmin/setup mv -v myadmin/config/config.inc.php myadmin/config.inc.php sudo chown ************ myadmin/config.inc.php rmdir myadmin/config sudo service php5-fpm […]
Create mysql system db
# see also https://adrhc.go.ro/wordpress/mysql-command-line/ #CREATE SYSTEM DB (first step and mandatory before using mysql) export SRVPATH=/ffp/opt/srv mkdir -p $SRVPATH/mysql/innodb/ mkdir -p $SRVPATH/mysql/innodblogdir/ mkdir -p $SRVPATH/mysql/binlog/ mkdir -p $SRVPATH/mysql/log/ mkdir -p $SRVPATH/mysql/tmp/ mkdir -p $SRVPATH/mysql/data cd /ffp # use your my.cnf […]
Compiling mysql 5.6.24
#See https://adrhc.go.ro/wordpress/common-commands-when-building/ for building environment, x.sh script and other things not defined here. #Before starting declare the environment variables specified at the link above. NEW_BUILD_NAME=mysql #NEW_BUILD_VER=5.6.24.large NEW_BUILD_VER=5.6.24.small+innodb NEW_BUILD_NAME_AND_VER=$NEW_BUILD_NAME-$NEW_BUILD_VER ls -l /tmp/$NEW_BUILD_NAME-* ls -l ~/ffp_0.7_armv5/packages/$NEW_BUILD_NAME-* NEW_BUILD_NR=0 cd $HOME/compile rm -r $HOME/compile/$NEW_BUILD_NAME_AND_VER […]
JPA vs Hibernate
@Formula (hibernate)
Tomcat datasource in context.xml
<Resource name=”exifweb” auth=”Container” type=”javax.sql.DataSource” factory=”org.apache.tomcat.jdbc.pool.DataSourceFactory” testWhileIdle=”true” testOnBorrow=”true” testOnReturn=”false” validationQuery=”SELECT 1″ validationInterval=”30000″ timeBetweenEvictionRunsMillis=”30000″ maxActive=”10″ minIdle=”2″ maxIdle=”3″ maxWait=”5000″ initialSize=”1″ removeAbandonedTimeout=”60″ removeAbandoned=”false” logAbandoned=”false” minEvictableIdleTimeMillis=”30000″ jmxEnabled=”false” jdbcInterceptors=”org.apache.tomcat.jdbc.pool.interceptor.ConnectionState” username=”exifweb” password=”exifweb” driverClassName=”com.mysql.jdbc.Driver” url=”jdbc:mysql://localhost:3306/exifweb”/>
Mysql command line
# connecting to exifweb database: mysql -u exifweb -p use exifweb insert into AppConfig values (null, ‘false’, ‘cpu summary: use sum on ps aux command’, now()); exit or CTRL+D # https://dev.mysql.com/doc/mysql-utilities/1.6/en/mysql-utils-intro-connspec-mylogin.cnf.html # avoid warning for commands like: mysql -u root […]
Mysql backup
mysqldump –ignore-table=exifweb.Image –databases exifweb –skip-comments -u root –password > 2014-08-28\ exifweb.sql mysqldump -u root –password exifweb Image > 2014-08-28\ exifweb\ Image\ only.sql mysqldump -u root –password –databases exifweb > 2014-08-28\ exifweb.sql mysqldump -u root –password exifweb | gzip > exifweb.sql.gz […]
Mysql EXPLAIN select
EXPLAIN EXTENDED select albumcover0_.id as id1_5_, albumcover0_.dirty as dirty2_5_, albumcover0_.imageHeight as imageHei3_5_, albumcover0_.imageWidth as imageWid4_5_, albumcover0_.imgName as imgName5_5_, albumcover0_.name as name6_5_ from v_album_cover albumcover0_ order by albumcover0_.name DESC