Skip to content

Commit

Permalink
removed logging from naming strategies
Browse files Browse the repository at this point in the history
  • Loading branch information
1azyman committed Dec 6, 2017
1 parent 1e9f605 commit 6d848fa
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 20 deletions.
Expand Up @@ -44,6 +44,7 @@
<prop key="hibernate.id.new_generator_mappings">true</prop>
<prop key="hibernate.jdbc.batch_size">20</prop>
<prop key="javax.persistence.validation.mode">none</prop>
<!--<prop key="hibernate.transaction.coordinator_class">jta</prop>-->
</props>
</property>
<property name="implicitNamingStrategy">
Expand Down Expand Up @@ -75,6 +76,11 @@
</property>
</bean>

<bean id="transactionManager"
class="org.springframework.orm.hibernate5.HibernateTransactionManager">
<property name="sessionFactory" ref="testSessionFactory" />
</bean>

<context:annotation-config />
<context:component-scan base-package="com.evolveum.midpoint.repo.sql.helpers" />

Expand Down
Expand Up @@ -16,8 +16,6 @@

package com.evolveum.midpoint.repo.sql.util;

import com.evolveum.midpoint.util.logging.Trace;
import com.evolveum.midpoint.util.logging.TraceManager;
import org.apache.commons.lang.StringUtils;
import org.hibernate.boot.model.naming.Identifier;
import org.hibernate.boot.model.naming.ImplicitBasicColumnNameSource;
Expand All @@ -34,8 +32,6 @@
*/
public class MidPointImplicitNamingStrategy extends ImplicitNamingStrategyLegacyHbmImpl {

private static final Trace LOGGER = TraceManager.getTrace(MidPointImplicitNamingStrategy.class);

@Override
public Identifier determineJoinColumnName(ImplicitJoinColumnNameSource source) {
Identifier i = super.determineJoinColumnName(source);
Expand Down Expand Up @@ -72,10 +68,8 @@ public Identifier determineJoinColumnName(ImplicitJoinColumnNameSource source) {
columnName = property + StringUtils.capitalize(columnName);

real = toIdentifier(StringUtils.join(Arrays.asList(translatedParent, columnName), "_"), source.getBuildingContext());

}

LOGGER.trace("determineJoinColumnName {} {} -> {}, {}", source.getReferencedTableName(), source.getReferencedColumnName(), i, real);
return real;
}

Expand All @@ -88,9 +82,7 @@ public Identifier determineBasicColumnName(ImplicitBasicColumnNameSource source)
if (fullPath.startsWith("credentials.") || fullPath.startsWith("activation.")) {
//credentials and activation are embedded and doesn't need to be qualified

Identifier i = super.determineBasicColumnName(source);
LOGGER.trace("determineBasicColumnName {} {}", fullPath, i);
return i;
return super.determineBasicColumnName(source);
} else {
if (fullPath.contains("&&")) {
// it's collection
Expand All @@ -101,8 +93,6 @@ public Identifier determineBasicColumnName(ImplicitBasicColumnNameSource source)
}
result = RUtil.fixDBSchemaObjectNameLength(result);

Identifier i = toIdentifier(result, source.getBuildingContext());
LOGGER.trace("determineBasicColumnName {} {}", fullPath, i);
return i;
return toIdentifier(result, source.getBuildingContext());
}
}
Expand Up @@ -16,8 +16,6 @@

package com.evolveum.midpoint.repo.sql.util;

import com.evolveum.midpoint.util.logging.Trace;
import com.evolveum.midpoint.util.logging.TraceManager;
import com.google.common.base.CaseFormat;
import org.hibernate.boot.model.naming.Identifier;
import org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl;
Expand All @@ -28,22 +26,17 @@
*/
public class MidPointPhysicalNamingStrategy extends PhysicalNamingStrategyStandardImpl {

private static final Trace LOGGER = TraceManager.getTrace(MidPointPhysicalNamingStrategy.class);

@Override
public Identifier toPhysicalTableName(Identifier identifier, JdbcEnvironment jdbcEnvironment) {
String name = identifier.getText();
if (name.startsWith("m_") || "hibernate_sequence".equals(name)) {
LOGGER.trace("toPhysicalTableName {} {}", identifier, identifier);
return identifier;
}

name = name.substring(1);
name = "m_" + CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, name);
name = RUtil.fixDBSchemaObjectNameLength(name);

Identifier i = new Identifier(name, identifier.isQuoted());
LOGGER.trace("toPhysicalTableName {} {}", identifier, i);
return i;
return new Identifier(name, identifier.isQuoted());
}
}

0 comments on commit 6d848fa

Please sign in to comment.