Merge branch 'master' into JAVA-7244-Review_log_statements_for_projects

This commit is contained in:
Loredana Crusoveanu
2021-12-09 10:22:41 +02:00
committed by GitHub
1079 changed files with 12491 additions and 4924 deletions
@@ -0,0 +1,3 @@
### Relevant Articles:
- [Getting Started With Apache Derby](https://www.baeldung.com/java-apache-derby)
+5 -8
View File
@@ -1,15 +1,15 @@
<?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">
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>
<artifactId>apache-derby</artifactId>
<parent>
<artifactId>persistence-modules</artifactId>
<groupId>com.baeldung</groupId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>apache-derby</artifactId>
<dependencies>
<!-- https://mvnrepository.com/artifact/org.apache.derby/derby -->
@@ -18,15 +18,12 @@
<artifactId>derby</artifactId>
<version>10.13.1.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.derby/derbyclient -->
<dependency>
<groupId>org.apache.derby</groupId>
<artifactId>derbyclient</artifactId>
<version>10.13.1.1</version>
</dependency>
</dependencies>
</project>
@@ -44,7 +44,6 @@
</dependencies>
<properties>
<h2.version>1.4.200</h2.version>
<mssql.driver.version>8.4.1.jre11</mssql.driver.version>
<oracle.driver.version>10.2.0.4.0</oracle.driver.version>
<mysql.driver.version>8.0.22</mysql.driver.version>
@@ -22,12 +22,6 @@
<version>${postgresql.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>${assertj-core.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
@@ -61,8 +55,6 @@
</dependencies>
<properties>
<h2.version>1.4.200</h2.version>
<assertj-core.version>3.10.0</assertj-core.version>
<commons-dbcp2.version>2.4.0</commons-dbcp2.version>
<HikariCP.version>3.2.0</HikariCP.version>
<c3p0.version>0.9.5.2</c3p0.version>
+2 -2
View File
@@ -18,8 +18,8 @@
<dependencyManagement>
<dependencies>
<!-- for junit5 to successfully be able to discover junit4 tests, we need 4.12+ version of junit:junit in the classpath. hence forcing the
latest 4.13.2 available version for junit5 compatibility -->
<!-- for junit5 to successfully be able to discover junit4 tests, we need 4.12+ version of
junit:junit in the classpath. hence forcing the latest 4.13.2 available version for junit5 compatibility -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
@@ -45,7 +45,6 @@
<properties>
<hibernate-core.version>5.4.7.Final</hibernate-core.version>
<h2.version>1.4.200</h2.version>
<maven.deploy.skip>true</maven.deploy.skip>
<spring-boot.version>2.1.7.RELEASE</spring-boot.version>
<hibernate.core.version>5.4.7.Final</hibernate.core.version>
@@ -19,12 +19,6 @@
<artifactId>hibernate-core</artifactId>
<version>${hibernate.version}</version>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>${assertj-core.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
@@ -87,7 +81,6 @@
<hibernate.version>5.3.7.Final</hibernate.version>
<mysql.version>6.0.6</mysql.version>
<mariaDB4j.version>2.2.3</mariaDB4j.version>
<assertj-core.version>3.8.0</assertj-core.version>
<geodb.version>0.9</geodb.version>
<hsqldb.version>2.3.4</hsqldb.version>
</properties>
@@ -24,7 +24,7 @@ public class HibernateUtil {
settings.put(Environment.USER, "sa");
settings.put(Environment.PASS, "");
settings.put(Environment.DIALECT, "org.hibernate.dialect.HSQLDialect");
settings.put(Environment.SHOW_SQL, "true");
settings.put(Environment.SHOW_SQL, "false");
settings.put(Environment.HBM2DDL_AUTO, "update");
configuration.setProperties(settings);
configuration.addAnnotatedClass(User.class);
@@ -27,7 +27,7 @@ public class HibernateUtil {
settings.put(Environment.USER, "sa");
settings.put(Environment.PASS, "");
settings.put(Environment.DIALECT, "org.hibernate.dialect.HSQLDialect");
settings.put(Environment.SHOW_SQL, "true");
settings.put(Environment.SHOW_SQL, "false");
settings.put(Environment.USE_SQL_COMMENTS, "true");
settings.put(Environment.HBM2DDL_AUTO, "update");
configuration.setProperties(settings);
@@ -45,12 +45,6 @@
<artifactId>spring-boot-starter-test</artifactId>
<version>${spring-boot.version}</version>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>${assertj-core.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
@@ -92,7 +86,6 @@
<hibernate.version>5.3.7.Final</hibernate.version>
<mysql.version>8.0.13</mysql.version>
<mariaDB4j.version>2.2.3</mariaDB4j.version>
<assertj-core.version>3.8.0</assertj-core.version>
<spring-boot.version>2.1.7.RELEASE</spring-boot.version>
</properties>
@@ -1,5 +1,5 @@
hibernate.connection.driver_class=org.h2.Driver
hibernate.connection.url=jdbc:h2:mem:mydb3;DB_CLOSE_DELAY=-1;LOCK_TIMEOUT=100;MVCC=FALSE
hibernate.connection.url=jdbc:h2:mem:mydb3;DB_CLOSE_DELAY=-1;LOCK_TIMEOUT=100
hibernate.connection.username=sa
hibernate.connection.autocommit=true
hibernate.dialect=org.hibernate.dialect.H2Dialect
@@ -62,12 +62,6 @@
<version>${hibernate.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>${assertj-core.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
@@ -166,7 +160,6 @@
</profiles>
<properties>
<assertj-core.version>3.15.0</assertj-core.version>
<datasource-proxy.version>1.6</datasource-proxy.version>
<guava.version>29.0-jre</guava.version>
<hibernate-types.version>2.9.7</hibernate-types.version>
@@ -29,12 +29,6 @@
<artifactId>hibernate-types-52</artifactId>
<version>${hibernate-types.version}</version>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>${assertj-core.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
@@ -75,9 +69,9 @@
</dependencies>
<properties>
<h2.version>1.4.197</h2.version> <!-- needs to be specified as it fails with parent's 1.4.200 -->
<hibernate.version>5.4.12.Final</hibernate.version>
<hibernate-types.version>2.10.4</hibernate-types.version>
<assertj-core.version>3.8.0</assertj-core.version>
<hibernate-validator.version>6.0.16.Final</hibernate-validator.version>
<org.glassfish.javax.el.version>3.0.1-b11</org.glassfish.javax.el.version>
<money-api.version>1.0.3</money-api.version>
@@ -19,12 +19,6 @@
<artifactId>hibernate-core</artifactId>
<version>${hibernate.version}</version>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>${assertj-core.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
@@ -60,7 +54,6 @@
<properties>
<mysql.version>6.0.6</mysql.version>
<mariaDB4j.version>2.2.3</mariaDB4j.version>
<assertj-core.version>3.8.0</assertj-core.version>
</properties>
</project>
-7
View File
@@ -19,12 +19,6 @@
<artifactId>hibernate-core</artifactId>
<version>${hibernate.version}</version>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>${assertj-core.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
@@ -66,7 +60,6 @@
<hibernate.version>5.4.12.Final</hibernate.version>
<mysql.version>6.0.6</mysql.version>
<mariaDB4j.version>2.2.3</mariaDB4j.version>
<assertj-core.version>3.8.0</assertj-core.version>
</properties>
</project>
@@ -16,7 +16,7 @@ public class CustomInterceptor extends EmptyInterceptor {
@Override
public boolean onSave(Object entity, Serializable id, Object[] state, String[] propertyNames, Type[] types) {
if (entity instanceof User) {
logger.info(((User) entity).toString());
logger.debug(entity.toString());
}
return super.onSave(entity, id, state, propertyNames, types);
}
@@ -25,7 +25,7 @@ public class CustomInterceptor extends EmptyInterceptor {
public boolean onFlushDirty(Object entity, Serializable id, Object[] currentState, Object [] previousState, String[] propertyNames, Type[] types) {
if (entity instanceof User) {
((User) entity).setLastModified(new Date());
logger.info(((User) entity).toString());
logger.debug(entity.toString());
}
return super.onFlushDirty(entity, id, currentState, previousState, propertyNames, types);
}
@@ -1,7 +1,5 @@
package com.baeldung.hibernate.interceptors.entity;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
@@ -9,6 +7,7 @@ import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import java.util.Date;
@Entity(name = "hbi_user")
public class User {
@@ -42,9 +42,9 @@ public class HibernateHiloUnitTest {
private void configureLogger() {
BasicConfigurator.configure();
LogManager.getLogger("org.hibernate").setLevel(Level.ERROR);
LogManager.getLogger("org.hibernate.id.enhanced.SequenceStructure").setLevel(Level.DEBUG);
LogManager.getLogger("org.hibernate.event.internal.AbstractSaveEventListener").setLevel(Level.DEBUG);
LogManager.getLogger("org.hibernate.SQL").setLevel(Level.DEBUG);
LogManager.getLogger("org.hibernate.id.enhanced.SequenceStructure").setLevel(Level.INFO);
LogManager.getLogger("org.hibernate.event.internal.AbstractSaveEventListener").setLevel(Level.INFO);
LogManager.getLogger("org.hibernate.SQL").setLevel(Level.INFO);
}
@@ -1,5 +1,8 @@
package com.baeldung.hibernate.proxy;
import org.apache.log4j.BasicConfigurator;
import org.apache.log4j.Level;
import org.apache.log4j.LogManager;
import org.hibernate.*;
import org.hibernate.proxy.HibernateProxy;
import org.junit.After;
@@ -2,7 +2,7 @@ hibernate.connection.driver_class=org.h2.Driver
hibernate.connection.url=jdbc:h2:mem:hilo_db;DB_CLOSE_DELAY=-1
hibernate.connection.username=sa
hibernate.dialect=org.hibernate.dialect.H2Dialect
hibernate.show_sql=true
hibernate.show_sql=false
hibernate.hbm2ddl.auto=create-drop
hibernate.c3p0.min_size=5
hibernate.c3p0.max_size=20
@@ -5,6 +5,6 @@ hibernate.connection.autocommit=true
jdbc.password=
hibernate.dialect=org.hibernate.dialect.H2Dialect
hibernate.show_sql=true
hibernate.show_sql=false
hibernate.hbm2ddl.auto=create-drop
hibernate.current_session_context_class=org.hibernate.context.internal.ThreadLocalSessionContext
@@ -5,5 +5,5 @@ hibernate.connection.password=
hibernate.connection.autocommit=true
hibernate.dialect=org.hibernate.dialect.H2Dialect
hibernate.show_sql=true
hibernate.show_sql=false
hibernate.hbm2ddl.auto=validate
@@ -3,7 +3,7 @@ hibernate.connection.url=jdbc:h2:mem:mydb1;DB_CLOSE_DELAY=-1
hibernate.connection.username=sa
hibernate.dialect=org.hibernate.dialect.H2Dialect
hibernate.show_sql=true
hibernate.show_sql=false
hibernate.hbm2ddl.auto=create-drop
hibernate.physical_naming_strategy=com.baeldung.hibernate.namingstrategy.CustomPhysicalNamingStrategy
@@ -3,5 +3,5 @@ hibernate.connection.url=jdbc:h2:mem:mydb1;DB_CLOSE_DELAY=-1
hibernate.connection.username=sa
hibernate.dialect=org.hibernate.dialect.H2Dialect
hibernate.show_sql=true
hibernate.show_sql=false
hibernate.hbm2ddl.auto=create-drop
@@ -5,7 +5,7 @@ hibernate.connection.autocommit=true
jdbc.password=
hibernate.dialect=org.hibernate.dialect.H2Dialect
hibernate.show_sql=true
hibernate.show_sql=false
hibernate.hbm2ddl.auto=create-drop
hibernate.c3p0.min_size=5
-7
View File
@@ -58,12 +58,6 @@
<artifactId>querydsl-jpa</artifactId>
<version>${querydsl.version}</version>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>${assertj.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
@@ -139,7 +133,6 @@
<hibernate.version>5.4.14.Final</hibernate.version>
<eclipselink.version>2.7.4</eclipselink.version>
<javax.persistence-api.version>2.2</javax.persistence-api.version>
<assertj.version>3.11.1</assertj.version>
<maven-compiler-plugin.version>3.5.1</maven-compiler-plugin.version>
<maven-processor-plugin.version>3.3.3</maven-processor-plugin.version>
<build-helper-maven-plugin.version>3.0.0</build-helper-maven-plugin.version>
-1
View File
@@ -13,5 +13,4 @@ This module contains articles about the Java Persistence API (JPA) in Java.
- [Returning an Auto-Generated Id with JPA](https://www.baeldung.com/jpa-get-auto-generated-id)
- [How to Return Multiple Entities In JPA Query](https://www.baeldung.com/jpa-return-multiple-entities)
- [Defining Unique Constraints in JPA](https://www.baeldung.com/jpa-unique-constraints)
- [How to Check Field Existence in MongoDB?](https://www.baeldung.com/mongodb-check-field-exists)
- [Connecting to a Specific Schema in JDBC](https://www.baeldung.com/jdbc-connect-to-schema)
-13
View File
@@ -62,18 +62,6 @@
<version>${postgresql.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>${assertj.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<version>${junit-jupiter.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>postgresql</artifactId>
@@ -100,7 +88,6 @@
<eclipselink.version>2.7.4</eclipselink.version>
<mysql.version>8.0.21</mysql.version>
<javax.persistence-api.version>2.2</javax.persistence-api.version>
<assertj.version>3.11.1</assertj.version>
<maven-compiler-plugin.version>3.5.1</maven-compiler-plugin.version>
<maven-processor-plugin.version>3.3.3</maven-processor-plugin.version>
<build-helper-maven-plugin.version>3.0.0</build-helper-maven-plugin.version>
+1 -1
View File
@@ -10,5 +10,5 @@ This module contains articles about MongoDB in Java.
- [Geospatial Support in MongoDB](https://www.baeldung.com/mongodb-geospatial-support)
- [Introduction to Morphia – Java ODM for MongoDB](https://www.baeldung.com/mongodb-morphia)
- [MongoDB Aggregations Using Java](https://www.baeldung.com/java-mongodb-aggregations)
- [MongoDB BSON to JSON](https://www.baeldung.com/bson-to-json)
- [BSON to JSON Document Conversion in Java](https://www.baeldung.com/java-convert-bson-to-json)
- [How to Check Field Existence in MongoDB?](https://www.baeldung.com/mongodb-check-field-exists)

Some files were not shown because too many files have changed in this diff Show More