mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-10-23 01:07:49 +00:00
#2473 - Oracle - column alias - Change such that OraclePlatform doesn't use column alias
So with #2254 we regressed OraclePlatform to use column alias. This really should have introduced an Oracle12 platform instead. 18c onwards and we don't want the column alias.
This commit is contained in:
@@ -11,6 +11,7 @@ public class Oracle11Platform extends OraclePlatform {
|
||||
public Oracle11Platform() {
|
||||
super();
|
||||
this.platform = Platform.ORACLE11;
|
||||
this.columnAliasPrefix = "c";
|
||||
this.sqlLimiter = new OracleRownumSqlLimiter();
|
||||
this.basicSqlLimiter = new OracleRownumBasicLimiter();
|
||||
dbIdentity.setIdType(IdType.SEQUENCE);
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package io.ebean.config.dbplatform.oracle;
|
||||
|
||||
/**
|
||||
* Oracle 12 platform using column alias.
|
||||
*/
|
||||
public class Oracle12Platform extends OraclePlatform {
|
||||
|
||||
public Oracle12Platform() {
|
||||
super();
|
||||
//this.platform = Platform.ORACLE12;
|
||||
this.columnAliasPrefix = "c";
|
||||
}
|
||||
}
|
||||
@@ -22,7 +22,6 @@ public class OraclePlatform extends DatabasePlatform {
|
||||
public OraclePlatform() {
|
||||
super();
|
||||
this.platform = Platform.ORACLE;
|
||||
this.columnAliasPrefix = "c";
|
||||
this.supportsDeleteTableAlias = true;
|
||||
this.maxTableNameLength = 30;
|
||||
this.maxConstraintNameLength = 30;
|
||||
|
||||
@@ -13,6 +13,7 @@ import io.ebean.config.dbplatform.mysql.MySql55Platform;
|
||||
import io.ebean.config.dbplatform.mysql.MySqlPlatform;
|
||||
import io.ebean.config.dbplatform.nuodb.NuoDbPlatform;
|
||||
import io.ebean.config.dbplatform.oracle.Oracle11Platform;
|
||||
import io.ebean.config.dbplatform.oracle.Oracle12Platform;
|
||||
import io.ebean.config.dbplatform.oracle.OraclePlatform;
|
||||
import io.ebean.config.dbplatform.postgres.Postgres9Platform;
|
||||
import io.ebean.config.dbplatform.postgres.PostgresPlatform;
|
||||
@@ -25,11 +26,7 @@ import io.ebeaninternal.api.DbOffline;
|
||||
|
||||
import javax.persistence.PersistenceException;
|
||||
import javax.sql.DataSource;
|
||||
import java.sql.Connection;
|
||||
import java.sql.DatabaseMetaData;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.*;
|
||||
|
||||
/**
|
||||
* Create a DatabasePlatform from the configuration.
|
||||
@@ -87,6 +84,9 @@ public class DatabasePlatformFactory {
|
||||
if (dbName.equals("oracle11") || dbName.equals("oracle10") || dbName.equals("oracle9")) {
|
||||
return new Oracle11Platform();
|
||||
}
|
||||
if (dbName.equals("oracle12")) {
|
||||
return new Oracle12Platform();
|
||||
}
|
||||
if (dbName.equals("oracle")) {
|
||||
return new OraclePlatform();
|
||||
}
|
||||
@@ -173,7 +173,13 @@ public class DatabasePlatformFactory {
|
||||
}
|
||||
|
||||
private DatabasePlatform oracleVersion(int majorVersion) {
|
||||
return majorVersion < 12 ? new Oracle11Platform() : new OraclePlatform();
|
||||
if (majorVersion < 12) {
|
||||
return new Oracle11Platform();
|
||||
}
|
||||
if (majorVersion < 13) {
|
||||
return new Oracle12Platform();
|
||||
}
|
||||
return new OraclePlatform();
|
||||
}
|
||||
|
||||
private DatabasePlatform mysqlVersion(int majorVersion, int minorVersion) {
|
||||
|
||||
@@ -2,28 +2,34 @@ package io.ebean.config.dbplatform;
|
||||
|
||||
import io.ebean.config.PlatformConfig;
|
||||
import io.ebean.config.dbplatform.oracle.Oracle11Platform;
|
||||
import io.ebean.config.dbplatform.oracle.Oracle12Platform;
|
||||
import io.ebean.config.dbplatform.oracle.OraclePlatform;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
public class OraclePlatformTest {
|
||||
class OraclePlatformTest {
|
||||
|
||||
@Test
|
||||
public void columnAliasPrefix_Oracle11Platform() {
|
||||
void columnAliasPrefix_Oracle11Platform() {
|
||||
Oracle11Platform platform11 = new Oracle11Platform();
|
||||
assertThat(platform11.columnAliasPrefix).isEqualTo("c");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void columnAliasPrefix_OraclePlatform() {
|
||||
OraclePlatform platform = new OraclePlatform();
|
||||
assertThat(platform.columnAliasPrefix).isEqualTo("c");
|
||||
void columnAliasPrefix_Oracle12Platform() {
|
||||
Oracle12Platform platform12 = new Oracle12Platform();
|
||||
assertThat(platform12.columnAliasPrefix).isEqualTo("c");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void uuid_default() {
|
||||
void columnAliasPrefix_OraclePlatform() {
|
||||
OraclePlatform platform = new OraclePlatform();
|
||||
assertThat(platform.columnAliasPrefix).isNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
void uuid_default() {
|
||||
OraclePlatform platform = new OraclePlatform();
|
||||
platform.configure(new PlatformConfig(), false);
|
||||
DbPlatformType dbType = platform.getDbTypeMap().get(DbPlatformType.UUID);
|
||||
@@ -31,8 +37,7 @@ public class OraclePlatformTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void uuid_as_binary() {
|
||||
|
||||
void uuid_as_binary() {
|
||||
OraclePlatform platform = new OraclePlatform();
|
||||
PlatformConfig config = new PlatformConfig();
|
||||
config.setDbUuid(PlatformConfig.DbUuid.AUTO_BINARY);
|
||||
|
||||
Reference in New Issue
Block a user