NEU: Db2 Tablespaces (#59)

* first commit

* second commit, it works for db2

* create table index in TS

* IndexTS & runPlacholdersMap

* Zwischencommit

* Implemented Tablespaces

* Update PR

* Zwischencommit

* release.md

* add lobTablespace support

* ebean-annotation 7.7

* create index in TS ausgebaut

* Fix Mergekonflikte

* Migrationsskripte neu generiert

* Revert "Migrationsskripte neu generiert"

This reverts commit 2690718b92701c0f34661d309c129b97e3cbe053.

* Revert "Fix Mergekonflikte"

This reverts commit e073e25048af88205259fd6b0873c4227b27d205.

* revert merge commit

* Resolved merge commits

* FIX: More merge conflicts and compile errors

* FIX: platform.base problem

* tableName uppercase

* Reviewkommentare Teil 1

* Reviewkommentare Teil 2

* DbMigrationTest für DB2 gefixt

* revert whitespaces

* Review

* review

Co-authored-by: Roland Praml <roland.praml@foconis.de>
This commit is contained in:
NSzemenyeiandRoland Praml authored and GitHub committed 2022-02-04 13:04:34 +01:00
1 parent 09230924f7
commit 4fe6f0cb13
41 files changed
+996 -42

No files matched your search

@@ -121,6 +121,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
private final boolean softDelete;
private final String draftTable;
private final PartitionMeta partitionMeta;
private final TablespaceMeta tablespaceMeta;
private final String storageEngine;
private final String dbComment;
private final boolean readAuditing;
@@ -275,6 +276,7 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
this.dependentTables = deploy.getDependentTables();
this.dbComment = deploy.getDbComment();
this.partitionMeta = deploy.getPartitionMeta();
this.tablespaceMeta = deploy.getTablespaceMeta();
this.storageEngine = deploy.getStorageEngine();
this.autoTunable = beanFinder == null && (entityType == EntityType.ORM || entityType == EntityType.VIEW);
// helper object used to derive lists of properties
@@ -2671,6 +2673,13 @@ public class BeanDescriptor<T> implements BeanType<T>, STreeType, SpiBeanType {
public PartitionMeta partitionMeta() {
return partitionMeta;
}
/**
* Return the tablespace details of the bean.
*/
public TablespaceMeta tablespaceMeta() {
return tablespaceMeta;
}
/**
* Return the storage engine.
@@ -0,0 +1,63 @@
package io.ebeaninternal.server.deploy;
import java.util.Objects;
/**
* Meta data for table spaces.
* If table space is configured, tablespaceName, indexTablespace, lobTablespace is never null;
*
* @author Noemi Szemenyei, FOCONIS AG
*
*/
public final class TablespaceMeta {
private final String tablespaceName;
private final String indexTablespace;
private final String lobTablespace;
public TablespaceMeta(String tablespaceName, String indexTablespace, String lobTablespace) {
this.tablespaceName = tablespaceName;
this.indexTablespace = indexTablespace;
this.lobTablespace = lobTablespace;
}
public String getTablespaceName() {
return tablespaceName;
}
public String getIndexTablespace() {
return indexTablespace;
}
public String getLobTablespace() {
return lobTablespace;
}
@Override
public int hashCode() {
return Objects.hash(indexTablespace, tablespaceName, lobTablespace);
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
TablespaceMeta other = (TablespaceMeta) obj;
return Objects.equals(indexTablespace, other.indexTablespace)
&& Objects.equals(tablespaceName, other.tablespaceName)
&& Objects.equals(lobTablespace, other.lobTablespace);
}
@Override
public String toString() {
return "tablespace=" + tablespaceName + ", indexTablespace=" + indexTablespace + ", lobTablespace=" + lobTablespace;
}
}
@@ -35,6 +35,7 @@ import io.ebeaninternal.server.deploy.IndexDefinition;
import io.ebeaninternal.server.deploy.InheritInfo;
import io.ebeaninternal.server.deploy.PartitionMeta;
import io.ebeaninternal.server.deploy.TableJoin;
import io.ebeaninternal.server.deploy.TablespaceMeta;
import io.ebeaninternal.server.deploy.parse.DeployBeanInfo;
import io.ebeaninternal.server.idgen.UuidV1IdGenerator;
import io.ebeaninternal.server.idgen.UuidV1RndIdGenerator;
@@ -140,6 +141,7 @@ public class DeployBeanDescriptor<T> implements DeployBeanDescriptorMeta {
private ChangeLogFilter changeLogFilter;
private String dbComment;
private PartitionMeta partitionMeta;
private TablespaceMeta tablespaceMeta;
/**
* One of NONE, INDEX or EMBEDDED.
*/
@@ -261,6 +263,14 @@ public class DeployBeanDescriptor<T> implements DeployBeanDescriptorMeta {
}
return partitionMeta;
}
public void setTablespaceMeta(TablespaceMeta tablespaceMeta) {
this.tablespaceMeta = tablespaceMeta;
}
public TablespaceMeta getTablespaceMeta() {
return tablespaceMeta;
}
public void setDraftable() {
draftable = true;
@@ -14,6 +14,7 @@ import io.ebean.annotation.Index;
import io.ebean.annotation.InvalidateQueryCache;
import io.ebean.annotation.ReadAudit;
import io.ebean.annotation.StorageEngine;
import io.ebean.annotation.Tablespace;
import io.ebean.annotation.View;
import io.ebean.config.TableName;
import io.ebean.util.AnnotationUtil;
@@ -22,6 +23,7 @@ import io.ebeaninternal.server.deploy.BeanDescriptor.EntityType;
import io.ebeaninternal.server.deploy.IndexDefinition;
import io.ebeaninternal.server.deploy.InheritInfo;
import io.ebeaninternal.server.deploy.PartitionMeta;
import io.ebeaninternal.server.deploy.TablespaceMeta;
import io.ebeaninternal.server.deploy.meta.DeployBeanProperty;
import javax.persistence.AttributeOverride;
@@ -158,6 +160,18 @@ final class AnnotationClass extends AnnotationParser {
if (partition != null) {
descriptor.setPartitionMeta(new PartitionMeta(partition.mode(), partition.property()));
}
Tablespace tablespace = typeGet(cls, Tablespace.class);
if (tablespace != null) {
String indexTs = tablespace.index();
if("".equals(indexTs)) {
indexTs = tablespace.value();
}
String lobTs = tablespace.lob();
if("".equals(lobTs)) {
lobTs = tablespace.value();
}
descriptor.setTablespaceMeta(new TablespaceMeta(tablespace.value(), indexTs, lobTs));
}
Draftable draftable = typeGet(cls, Draftable.class);
if (draftable != null) {
descriptor.setDraftable();