Я пытался создать цепочку выпадающих для деревни, в настоящее время удается создать из провинции в подрайоны.
Итак, я создал файл Village.java для фильтрации:
пакет com.sun.pro.aub.domain;
import java.util.Objects;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringExclude;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.fasterxml.jackson.annotation.JsonIgnore;
/**
* Village 4th level.
* Sub District
*
* @author dev on 1:53:29 PM
* @since 1.0.0
* @version 1.0.0
*
*/
@Entity
@Table(name = "villa")
public class Village {
@ToStringExclude
@Id
private Long id;
String name;
@ToStringExclude
@JsonIgnore
@ManyToOne
Village village;
/**
* Default ctr
*/
public Village() {
}
/**
* @param id the id
*/
public Village(Long id) {
super();
this.id = id;
}
/**
* @return the subDistrict
*/
public SubDistrict getSubDistrict() {
return subDistrict;
}
/**
* @param id
* village id
* @param subDistrictCity
* village subDistrict subDistrict
* @param name
* village name
*/
public Village(Long id, SubDistrict subDistrict, String name) {
this(id, name);
this.subDistrict = subDistrict;
}
public Village(Long id, String name) {
this.id = id;
this.name = name;
}
/**
* @return the id
*/
public Long getId() {
return id;
}
/**
* @return the name
*/
public String getName() {
return name;
}
/**
* @param districtCity the districtCity to set
* @return SubDistrict for convenience chaining
*/
public Village setSubDistrict(SubDistrict subDistrict) {
this.subDistrict = subDistrict;
return this;
}
/**
* @param id the id to set
* @return SubDistrict for convenience chaining
*/
public Village setId(Long id) {
this.id = id;
return this;
}
/**
* @param name the name to set
* @return SubDistrict for convenience chaining
*/
public Village setName(String name) {
this.name = name;
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Village o1 = (Village) o;
if (o1.id == null || id == null) {
return false;
}
return Objects.equals(id, o1.id);
}
@Override
public int hashCode() {
return Objects.hashCode(id);
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.NO_CLASS_NAME_STYLE);
}
}
Но при запуске mvn test выдает ошибки cannot find symbol subDistrict line 59, 72 and 99
в файле Village.java.
Этот деревенский файл совершенно такой же, как и файл SubDistrict, который я создал ранее.
Есть предложения?
Большое спасибо