HHH-4630 Simplifying test and applying formatting style

This commit is contained in:
Hardy Ferentschik 2011-07-13 11:44:24 +02:00
parent 3ec6c11f12
commit 99f8d26270
2 changed files with 22 additions and 35 deletions

View File

@ -26,10 +26,8 @@ package org.hibernate.loader;
import org.hibernate.internal.util.StringHelper;
/**
* TODO : javadoc
*
* @author Steve Ebersole
*/
* @author Steve Ebersole
*/
public class PropertyPath {
private final PropertyPath parent;
private final String property;
@ -42,21 +40,22 @@ public class PropertyPath {
// the _identifierMapper is a "hidden" property on entities with composite keys.
// concatenating it will prevent the path from correctly being used to look up
// various things such as criteria paths and fetch profile association paths
if ("_identifierMapper".equals(property)) {
this.fullPath = parent != null ? parent.getFullPath() : "";
} else {
if ( "_identifierMapper".equals( property ) ) {
this.fullPath = parent != null ? parent.getFullPath() : "";
}
else {
final String prefix;
if ( parent != null ) {
final String resolvedParent = parent.getFullPath();
if ( StringHelper.isEmpty( resolvedParent ) ) {
prefix = "";
}
else {
prefix = resolvedParent + '.';
}
final String resolvedParent = parent.getFullPath();
if ( StringHelper.isEmpty( resolvedParent ) ) {
prefix = "";
}
else {
prefix = resolvedParent + '.';
}
}
else {
prefix = "";
prefix = "";
}
this.fullPath = prefix + property;

View File

@ -25,13 +25,11 @@
package org.hibernate.test.criteria;
import java.util.Arrays;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.Id;
import javax.persistence.IdClass;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.MappedSuperclass;
import javax.persistence.Table;
@ -101,31 +99,24 @@ import static org.junit.Assert.assertEquals;
* shouldn't be exposed.
*
* @author Chris Wilson
* @link http://opensource.atlassian.com/projects/hibernate/browse/HHH-4630
* @link https://hibernate.onjira.com/browse/HHH-4630
*/
public class ComplexJoinAliasTest extends BaseCoreFunctionalTestCase {
@MappedSuperclass
private static abstract class VersionedRecord
implements java.io.Serializable {
@Column(name = "record_version", nullable = false)
private static abstract class VersionedRecord implements java.io.Serializable {
Long recordVersion;
@Column(name = "is_deleted", nullable = false, columnDefinition = "smallint")
Boolean isDeleted;
}
@Entity
@Table(name = "list_action_roles")
@IdClass(ListActionRole.class)
public static class ListActionRole extends VersionedRecord {
@Id
@Column(name = "role_code", length = 3)
@Enumerated(EnumType.STRING)
Role.Code roleCode;
Code roleCode;
@ManyToOne(targetEntity = Role.class)
@JoinColumn(name = "role_code", insertable = false, updatable = false)
@Id
Role role;
@Override
@ -142,16 +133,15 @@ public class ComplexJoinAliasTest extends BaseCoreFunctionalTestCase {
@Entity
@Table(name = "roles")
public static class Role extends VersionedRecord {
public enum Code {
ADM, CEN, RPA, RPP, PRJ, HUB, RQS, OAD, ORP, ORQ
}
@Id
@Column(name = "code", length = 3)
@Enumerated(EnumType.STRING)
Code code;
}
public static enum Code {
ADM, CEN, RPA, RPP, PRJ, HUB, RQS, OAD, ORP, ORQ
}
@Override
protected Class<?>[] getAnnotatedClasses() {
return new Class[] {
@ -178,5 +168,3 @@ public class ComplexJoinAliasTest extends BaseCoreFunctionalTestCase {
session.close();
}
}