HHH-4630 Simplifying test and applying formatting style
This commit is contained in:
parent
3ec6c11f12
commit
99f8d26270
|
@ -26,10 +26,8 @@ package org.hibernate.loader;
|
||||||
import org.hibernate.internal.util.StringHelper;
|
import org.hibernate.internal.util.StringHelper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO : javadoc
|
* @author Steve Ebersole
|
||||||
*
|
*/
|
||||||
* @author Steve Ebersole
|
|
||||||
*/
|
|
||||||
public class PropertyPath {
|
public class PropertyPath {
|
||||||
private final PropertyPath parent;
|
private final PropertyPath parent;
|
||||||
private final String property;
|
private final String property;
|
||||||
|
@ -42,21 +40,22 @@ public class PropertyPath {
|
||||||
// the _identifierMapper is a "hidden" property on entities with composite keys.
|
// the _identifierMapper is a "hidden" property on entities with composite keys.
|
||||||
// concatenating it will prevent the path from correctly being used to look up
|
// concatenating it will prevent the path from correctly being used to look up
|
||||||
// various things such as criteria paths and fetch profile association paths
|
// various things such as criteria paths and fetch profile association paths
|
||||||
if ("_identifierMapper".equals(property)) {
|
if ( "_identifierMapper".equals( property ) ) {
|
||||||
this.fullPath = parent != null ? parent.getFullPath() : "";
|
this.fullPath = parent != null ? parent.getFullPath() : "";
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
final String prefix;
|
final String prefix;
|
||||||
if ( parent != null ) {
|
if ( parent != null ) {
|
||||||
final String resolvedParent = parent.getFullPath();
|
final String resolvedParent = parent.getFullPath();
|
||||||
if ( StringHelper.isEmpty( resolvedParent ) ) {
|
if ( StringHelper.isEmpty( resolvedParent ) ) {
|
||||||
prefix = "";
|
prefix = "";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
prefix = resolvedParent + '.';
|
prefix = resolvedParent + '.';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
prefix = "";
|
prefix = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
this.fullPath = prefix + property;
|
this.fullPath = prefix + property;
|
||||||
|
|
|
@ -25,13 +25,11 @@
|
||||||
package org.hibernate.test.criteria;
|
package org.hibernate.test.criteria;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import javax.persistence.Column;
|
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.EnumType;
|
import javax.persistence.EnumType;
|
||||||
import javax.persistence.Enumerated;
|
import javax.persistence.Enumerated;
|
||||||
import javax.persistence.Id;
|
import javax.persistence.Id;
|
||||||
import javax.persistence.IdClass;
|
import javax.persistence.IdClass;
|
||||||
import javax.persistence.JoinColumn;
|
|
||||||
import javax.persistence.ManyToOne;
|
import javax.persistence.ManyToOne;
|
||||||
import javax.persistence.MappedSuperclass;
|
import javax.persistence.MappedSuperclass;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
|
@ -101,31 +99,24 @@ import static org.junit.Assert.assertEquals;
|
||||||
* shouldn't be exposed.
|
* shouldn't be exposed.
|
||||||
*
|
*
|
||||||
* @author Chris Wilson
|
* @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 {
|
public class ComplexJoinAliasTest extends BaseCoreFunctionalTestCase {
|
||||||
@MappedSuperclass
|
@MappedSuperclass
|
||||||
private static abstract class VersionedRecord
|
private static abstract class VersionedRecord implements java.io.Serializable {
|
||||||
implements java.io.Serializable {
|
|
||||||
@Column(name = "record_version", nullable = false)
|
|
||||||
Long recordVersion;
|
Long recordVersion;
|
||||||
|
|
||||||
@Column(name = "is_deleted", nullable = false, columnDefinition = "smallint")
|
|
||||||
Boolean isDeleted;
|
Boolean isDeleted;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "list_action_roles")
|
@IdClass(ListActionRole.class)
|
||||||
public static class ListActionRole extends VersionedRecord {
|
public static class ListActionRole extends VersionedRecord {
|
||||||
@Id
|
@Id
|
||||||
@Column(name = "role_code", length = 3)
|
|
||||||
@Enumerated(EnumType.STRING)
|
@Enumerated(EnumType.STRING)
|
||||||
Role.Code roleCode;
|
Code roleCode;
|
||||||
|
|
||||||
@ManyToOne(targetEntity = Role.class)
|
@ManyToOne(targetEntity = Role.class)
|
||||||
@JoinColumn(name = "role_code", insertable = false, updatable = false)
|
|
||||||
@Id
|
|
||||||
Role role;
|
Role role;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -142,16 +133,15 @@ public class ComplexJoinAliasTest extends BaseCoreFunctionalTestCase {
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "roles")
|
@Table(name = "roles")
|
||||||
public static class Role extends VersionedRecord {
|
public static class Role extends VersionedRecord {
|
||||||
public enum Code {
|
|
||||||
ADM, CEN, RPA, RPP, PRJ, HUB, RQS, OAD, ORP, ORQ
|
|
||||||
}
|
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
@Column(name = "code", length = 3)
|
|
||||||
@Enumerated(EnumType.STRING)
|
@Enumerated(EnumType.STRING)
|
||||||
Code code;
|
Code code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static enum Code {
|
||||||
|
ADM, CEN, RPA, RPP, PRJ, HUB, RQS, OAD, ORP, ORQ
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Class<?>[] getAnnotatedClasses() {
|
protected Class<?>[] getAnnotatedClasses() {
|
||||||
return new Class[] {
|
return new Class[] {
|
||||||
|
@ -178,5 +168,3 @@ public class ComplexJoinAliasTest extends BaseCoreFunctionalTestCase {
|
||||||
session.close();
|
session.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue