9
我试着来配置我的实体,而是冬眠引发以下异常:Hibernate映射例外 - 无法确定类型:
org.hibernate.MappingException: Could not determine type for: com.sd.entity.SDUserProductAcess, at table: SDUser, for columns: [org.hibernate.mapping.Column(productAccess)]
[PersistEngine] Failed to initialize persistence engine!java.lang.NullPointerException
这是我的实体:
@Entity
@Inheritance(strategy = InheritanceType.JOINED)
public class SDObject
{
@Id
@GeneratedValue
private long sdId;
private String sdType;
public long getSdId()
{
return sdId;
}
public void setSdId(long sdId)
{
this.sdId = sdId;
}
public String getSdType()
{
return sdType;
}
public void setSdType(String sdType)
{
this.sdType = sdType;
}
}
下一个:
@Entity
public class SDUser extends SDObject
{
@Column(unique = true)
private String code;
private String password;
private SDUserProductAcess productAccess;
public String getCode()
{
return code;
}
public void setCode(String code)
{
this.code = code;
}
public String getPassword()
{
return password;
}
public void setPassword(String password)
{
this.password = password;
}
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
public SDUserProductAcess getProductAccess()
{
return productAccess;
}
public void setProductAccess(SDUserProductAcess productAccess)
{
this.productAccess = productAccess;
}
最后一个:
@Entity
public class SDUserProductAcess extends SDObject
{
private boolean adm;
public boolean isAdm()
{
return adm;
}
public void setAdm(boolean adm)
{
this.adm = adm;
}
}
Hibernate无法确定位于SDUser实体中的productAccess列的类型。 我是Hibernate的新手,我无法弄清楚发生了什么。
我应该提供某种身份证吗?
谢谢!