HHH-14921 Test handling of default catalog and schema
This commit is contained in:
parent
4d5306a82d
commit
944c90061a
|
@ -53,6 +53,14 @@ public class IncrementGenerator implements IdentifierGenerator {
|
|||
|
||||
private IntegralDataTypeHolder previousValueHolder;
|
||||
|
||||
/**
|
||||
* @deprecated Exposed for tests only.
|
||||
*/
|
||||
@Deprecated
|
||||
public String[] getAllSqlForTests() {
|
||||
return new String[] { sql };
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized Object generate(SharedSessionContractImplementor session, Object object) throws HibernateException {
|
||||
if ( sql != null ) {
|
||||
|
|
|
@ -78,6 +78,14 @@ public class SequenceGenerator
|
|||
return physicalSequenceName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Exposed for tests only.
|
||||
*/
|
||||
@Deprecated
|
||||
public String[] getAllSqlForTests() {
|
||||
return new String[] { sql };
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("StatementWithEmptyBody")
|
||||
public void configure(Type type, Properties params, ServiceRegistry serviceRegistry) throws MappingException {
|
||||
|
|
|
@ -107,4 +107,12 @@ public interface DatabaseStructure extends ExportableProducer {
|
|||
* @return {@code true} if the actual database structure is a sequence; {@code false} otherwise.
|
||||
*/
|
||||
boolean isPhysicalSequence();
|
||||
|
||||
/**
|
||||
* @deprecated Exposed for tests only.
|
||||
*/
|
||||
@Deprecated
|
||||
public default String[] getAllSqlForTests() {
|
||||
return new String[] { };
|
||||
}
|
||||
}
|
||||
|
|
|
@ -81,6 +81,11 @@ public class SequenceStructure implements DatabaseStructure {
|
|||
return initialValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getAllSqlForTests() {
|
||||
return new String[] { sql };
|
||||
}
|
||||
|
||||
@Override
|
||||
public AccessCallback buildCallback(final SharedSessionContractImplementor session) {
|
||||
if ( sql == null ) {
|
||||
|
|
|
@ -324,6 +324,14 @@ public class TableGenerator implements PersistentIdentifierGenerator {
|
|||
return accessCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Exposed for tests only.
|
||||
*/
|
||||
@Deprecated
|
||||
public String[] getAllSqlForTests() {
|
||||
return new String[] { selectQuery, insertQuery, updateQuery };
|
||||
}
|
||||
|
||||
@Override
|
||||
public void configure(Type type, Properties params, ServiceRegistry serviceRegistry) throws MappingException {
|
||||
storeLastUsedValue = serviceRegistry.getService( ConfigurationService.class )
|
||||
|
|
|
@ -104,6 +104,11 @@ public class TableStructure implements DatabaseStructure {
|
|||
return accessCounter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getAllSqlForTests() {
|
||||
return new String[] { selectQuery, updateQuery };
|
||||
}
|
||||
|
||||
@Override
|
||||
public void prepare(Optimizer optimizer) {
|
||||
applyIncrementSizeToSourceValues = optimizer.applyIncrementSizeToSourceValues();
|
||||
|
|
|
@ -4692,6 +4692,14 @@ public abstract class AbstractEntityPersister
|
|||
return entityMetamodel.getIdentifierProperty().getIdentifierGenerator();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Exposed for tests only
|
||||
*/
|
||||
@Deprecated
|
||||
public InsertGeneratedIdentifierDelegate getIdentityDelegate() {
|
||||
return identityDelegate;
|
||||
}
|
||||
|
||||
public String getRootEntityName() {
|
||||
return entityMetamodel.getRootName();
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,17 @@
|
|||
<?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"
|
||||
catalog="someImplicitFileLevelCatalog" schema="someImplicitFileLevelSchema" default-access="field">
|
||||
<class name="DefaultCatalogAndSchemaTest$EntityWithHbmXmlImplicitFileLevelQualifiers" entity-name="EntityWithHbmXmlImplicitFileLevelQualifiers">
|
||||
<id name="id" />
|
||||
<property name="basic" />
|
||||
</class>
|
||||
</hibernate-mapping>
|
|
@ -0,0 +1,46 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
~ 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>.
|
||||
-->
|
||||
<entity-mappings xmlns="http://xmlns.jcp.org/xml/ns/persistence/orm"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence/orm
|
||||
http://xmlns.jcp.org/xml/ns/persistence/orm_2_1.xsd"
|
||||
version="2.1">
|
||||
<package>org.hibernate.test.boot.database.qualfiedTableNaming</package>
|
||||
<schema>someImplicitFileLevelSchema</schema>
|
||||
<catalog>someImplicitFileLevelCatalog</catalog>
|
||||
<entity class="DefaultCatalogAndSchemaTest$EntityWithOrmXmlImplicitFileLevelQualifiers" name="EntityWithOrmXmlImplicitFileLevelQualifiers"
|
||||
access="FIELD">
|
||||
<attributes>
|
||||
<id name="id"/>
|
||||
<basic name="basic"/>
|
||||
<one-to-many name="oneToMany">
|
||||
<join-table name="EntityWithOrmXmlImplicitFileLevelQualifiers_oneToMany">
|
||||
<!-- Custom names to avoid false positive in assertions -->
|
||||
<join-column name="forward" />
|
||||
<foreign-key name="FK_oneToMany" />
|
||||
<inverse-join-column name="inverse" />
|
||||
</join-table>
|
||||
</one-to-many>
|
||||
<many-to-many name="manyToMany">
|
||||
<join-table name="EntityWithOrmXmlImplicitFileLevelQualifiers_manyToMany">
|
||||
<!-- Custom names to avoid false positive in assertions -->
|
||||
<join-column name="forward" />
|
||||
<foreign-key name="FK_oneToMany" />
|
||||
<inverse-join-column name="inverse" />
|
||||
</join-table>
|
||||
</many-to-many>
|
||||
<element-collection name="elementCollection">
|
||||
<collection-table name="EntityWithOrmXmlImplicitFileLevelQualifiers_elementCollection">
|
||||
<!-- Custom names to avoid false positive in assertions -->
|
||||
<join-column name="forward" />
|
||||
<foreign-key name="FK_elementCollection" />
|
||||
</collection-table>
|
||||
</element-collection>
|
||||
</attributes>
|
||||
</entity>
|
||||
</entity-mappings>
|
|
@ -0,0 +1,19 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
~ 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>.
|
||||
-->
|
||||
<entity-mappings xmlns="http://xmlns.jcp.org/xml/ns/persistence/orm"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence/orm
|
||||
http://xmlns.jcp.org/xml/ns/persistence/orm_2_1.xsd"
|
||||
version="2.1">
|
||||
<persistence-unit-metadata>
|
||||
<persistence-unit-defaults>
|
||||
<schema>someImplicitSchema</schema>
|
||||
<catalog>someImplicitCatalog</catalog>
|
||||
</persistence-unit-defaults>
|
||||
</persistence-unit-metadata>
|
||||
</entity-mappings>
|
Loading…
Reference in New Issue