BAEL-3091: The Prototype Pattern in Java (changed code based on valid comments from a reader)

This commit is contained in:
Vivek Balasubramaniam
2019-10-29 22:27:15 +05:30
parent db85c8f275
commit d3d5b060e7
20517 changed files with 1642290 additions and 0 deletions
+2
View File
@@ -0,0 +1,2 @@
### Relevant Articles:
- [Introduction to Liquibase Rollback](http://www.baeldung.com/liquibase-rollback)
+43
View File
@@ -0,0 +1,43 @@
<?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">
<modelVersion>4.0.0</modelVersion>
<artifactId>liquibase</artifactId>
<name>liquibase</name>
<parent>
<artifactId>parent-modules</artifactId>
<groupId>com.baeldung</groupId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../../</relativePath>
</parent>
<dependencies>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>${mysql-connector-java.version}</version>
</dependency>
</dependencies>
<build>
<finalName>liquibase</finalName>
<plugins>
<plugin>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-maven-plugin</artifactId>
<version>${liquibase-maven-plugin.version}</version>
<configuration>
<propertyFile>liquibase/liquibase.properties</propertyFile>
<changeLogFile>liquibase/db-changelog.xml</changeLogFile>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<mysql-connector-java.version>5.1.6</mysql-connector-java.version>
<liquibase-maven-plugin.version>3.4.2</liquibase-maven-plugin.version>
</properties>
</project>
@@ -0,0 +1,69 @@
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.4.xsd">
<changeSet id="testRollback" author="baeldung">
<createTable tableName="baeldung_tutorial">
<column name="id" type="int"/>
<column name="heading" type="varchar(36)"/>
<column name="author" type="varchar(36)"/>
</createTable>
<rollback>
<dropTable tableName="baeldung_tutorial"/>
</rollback>
</changeSet>
<changeSet id="multiStatementRollback" author="baeldung">
<createTable tableName="baeldung_tutorial2">
<column name="id" type="int"/>
<column name="heading" type="varchar(36)"/>
<column name="author" type="varchar(36)"/>
</createTable>
<createTable tableName="baeldung_tutorial3">
<column name="id" type="int"/>
<column name="heading" type="varchar(36)"/>
<column name="author" type="varchar(36)"/>
</createTable>
<rollback>
<dropTable tableName="baeldung_tutorial2"/>
<dropTable tableName="baeldung_tutorial3"/>
</rollback>
</changeSet>
<changeSet id="multipleRollbackTags" author="baeldung">
<createTable tableName="baeldung_tutorial4">
<column name="id" type="int"/>
<column name="heading" type="varchar(36)"/>
<column name="author" type="varchar(36)"/>
</createTable>
<createTable tableName="baeldung_tutorial5">
<column name="id" type="int"/>
<column name="heading" type="varchar(36)"/>
<column name="author" type="varchar(36)"/>
</createTable>
<rollback>
<dropTable tableName="baeldung_tutorial4"/>
</rollback>
<rollback>
<dropTable tableName="baeldung_tutorial5"/>
</rollback>
</changeSet>
<changeSet id="referChangeSetForRollback" author="baeldung">
<dropTable tableName="baeldung_tutorial2"/>
<dropTable tableName="baeldung_tutorial3"/>
<rollback changeSetId="multiStatementRollback" changeSetAuthor="baeldung"/>
</changeSet>
<changeSet id="emptyRollback" author="baeldung">
<createTable tableName="baeldung_tutorial6">
<column name="id" type="int"/>
<column name="heading" type="varchar(36)"/>
<column name="author" type="varchar(36)"/>
</createTable>
<rollback/>
</changeSet>
</databaseChangeLog>
@@ -0,0 +1,4 @@
driver=com.mysql.jdbc.Driver
url=jdbc:mysql://localhost:3306/baeldung_liquibase
username=root
password=password
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
</pattern>
</encoder>
</appender>
<root level="INFO">
<appender-ref ref="STDOUT" />
</root>
</configuration>