HHH-15212 Test placeholders in auxiliary object SQL strings
This commit is contained in:
parent
73d07272fd
commit
863369c08e
|
@ -65,7 +65,6 @@ import org.hibernate.hql.spi.id.global.GlobalTemporaryTableBulkIdStrategy;
|
|||
import org.hibernate.hql.spi.id.local.LocalTemporaryTableBulkIdStrategy;
|
||||
import org.hibernate.id.IdentifierGenerator;
|
||||
import org.hibernate.persister.entity.AbstractEntityPersister;
|
||||
import org.hibernate.persister.entity.EntityPersister;
|
||||
import org.hibernate.service.spi.ServiceRegistryImplementor;
|
||||
import org.hibernate.tool.hbm2ddl.SchemaExport;
|
||||
import org.hibernate.tool.schema.TargetType;
|
||||
|
@ -86,7 +85,7 @@ import org.junit.runner.RunWith;
|
|||
import org.junit.runners.Parameterized;
|
||||
|
||||
@RunWith(CustomParameterized.class)
|
||||
@TestForIssue(jiraKey = { "HHH-14921", "HHH-14922" })
|
||||
@TestForIssue(jiraKey = { "HHH-14921", "HHH-14922", "HHH-15212" })
|
||||
@SkipForDialect(value = SybaseDialect.class, comment = "Sybase doesn't support sequences")
|
||||
@SkipForDialect(value = MySQLDialect.class, comment = "MySQL doesn't support sequences")
|
||||
@SkipForDialect(value = MariaDB53Dialect.class, strictMatching = true,
|
||||
|
@ -217,6 +216,8 @@ public class DefaultCatalogAndSchemaTest {
|
|||
final MetadataSources metadataSources = new MetadataSources( serviceRegistry );
|
||||
metadataSources.addInputStream( getClass().getResourceAsStream( "implicit-file-level-catalog-and-schema.orm.xml" ) );
|
||||
metadataSources.addInputStream( getClass().getResourceAsStream( "implicit-file-level-catalog-and-schema.hbm.xml" ) );
|
||||
metadataSources.addInputStream( getClass().getResourceAsStream( "database-object-using-catalog-placeholder.hbm.xml" ) );
|
||||
metadataSources.addInputStream( getClass().getResourceAsStream( "database-object-using-schema-placeholder.hbm.xml" ) );
|
||||
if ( configuredXmlMappingPath != null ) {
|
||||
metadataSources.addInputStream( getClass().getResourceAsStream( configuredXmlMappingPath ) );
|
||||
}
|
||||
|
@ -585,6 +586,15 @@ public class DefaultCatalogAndSchemaTest {
|
|||
verifyOnlyQualifier( sql, SqlType.DDL, EntityWithExplicitQualifiersWithEnhancedSequenceGenerator.NAME, expectedExplicitQualifier() );
|
||||
verifyOnlyQualifier( sql, SqlType.DDL, EntityWithDefaultQualifiersWithLegacySequenceGenerator.NAME, expectedDefaultQualifier() );
|
||||
verifyOnlyQualifier( sql, SqlType.DDL, EntityWithExplicitQualifiersWithLegacySequenceGenerator.NAME, expectedExplicitQualifier() );
|
||||
|
||||
if ( dbSupportsCatalogs && expectedDefaultCatalog != null ) {
|
||||
verifyOnlyQualifier( sql, SqlType.DDL, "catalogPrefixedAuxObject",
|
||||
expectedQualifier( expectedDefaultCatalog, null ) );
|
||||
}
|
||||
if ( dbSupportsSchemas && expectedDefaultSchema != null ) {
|
||||
verifyOnlyQualifier( sql, SqlType.DDL, "schemaPrefixedAuxObject",
|
||||
expectedQualifier( null, expectedDefaultSchema ) );
|
||||
}
|
||||
}
|
||||
|
||||
private enum SqlType {
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
<?xml version="1.0"?>
|
||||
<!--
|
||||
~ Hibernate, Relational Persistence for Idiomatic Java
|
||||
~
|
||||
~ License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||
~ See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||
-->
|
||||
<hibernate-mapping xmlns="http://www.hibernate.org/xsd/hibernate-mapping"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.hibernate.org/xsd/hibernate-mapping http://www.hibernate.org/xsd/hibernate-mapping/hibernate-mapping-4.0.xsd"
|
||||
package="org.hibernate.test.boot.database.qualfiedTableNaming"
|
||||
default-access="field">
|
||||
<database-object>
|
||||
<!-- Note this code does not actually get executed.
|
||||
We just generate the script and check that ${catalog} gets replaced correctly.
|
||||
So the actual language used here does not need to be compatible with the DB dialect under test.
|
||||
-->
|
||||
<create>
|
||||
CREATE OR REPLACE FUNCTION ${catalog}.catalogPrefixedAuxObject()
|
||||
RETURNS varchar AS
|
||||
$BODY$
|
||||
BEGIN
|
||||
SELECT 'test';
|
||||
END;
|
||||
$BODY$
|
||||
LANGUAGE plpgsql
|
||||
</create>
|
||||
<drop>DROP FUNCTION ${catalog}.catalogPrefixedAuxObject()</drop>
|
||||
</database-object>
|
||||
</hibernate-mapping>
|
|
@ -0,0 +1,30 @@
|
|||
<?xml version="1.0"?>
|
||||
<!--
|
||||
~ Hibernate, Relational Persistence for Idiomatic Java
|
||||
~
|
||||
~ License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||
~ See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||
-->
|
||||
<hibernate-mapping xmlns="http://www.hibernate.org/xsd/hibernate-mapping"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.hibernate.org/xsd/hibernate-mapping http://www.hibernate.org/xsd/hibernate-mapping/hibernate-mapping-4.0.xsd"
|
||||
package="org.hibernate.test.boot.database.qualfiedTableNaming"
|
||||
default-access="field">
|
||||
<database-object>
|
||||
<!-- Note this code does not actually get executed.
|
||||
We just generate the script and check that ${schema} gets replaced correctly.
|
||||
So the actual language used here does not need to be compatible with the DB dialect under test.
|
||||
-->
|
||||
<create>
|
||||
CREATE OR REPLACE FUNCTION ${schema}.schemaPrefixedAuxObject()
|
||||
RETURNS varchar AS
|
||||
$BODY$
|
||||
BEGIN
|
||||
SELECT 'test';
|
||||
END;
|
||||
$BODY$
|
||||
LANGUAGE plpgsql
|
||||
</create>
|
||||
<drop>DROP FUNCTION ${schema}.schemaPrefixedAuxObject()</drop>
|
||||
</database-object>
|
||||
</hibernate-mapping>
|
Loading…
Reference in New Issue