我有一个具有transient属性的实体:
@Entity
@Table(name = "asset")
public class Asset {
@Transient
private String locationIdentifier = "N/A";
@SuppressWarnings("unused")
@PostLoad
private void onPostLoad() {
if (location != null) {
locationIdentifier = location.getIdentifier();
}
}
[other stuffs]
}
Run Code Online (Sandbox Code Playgroud)
我试图locationIdentifier在JPA中访问这种方式:
String sqlString = "SELECT asset FROM Asset WHERE asset.locationIdentifier = :inputstr";
Query query = entityManager.createQuery(sqlString);
Run Code Online (Sandbox Code Playgroud)
但是我收到了一个错误: Cannot resolve the property locationIdentifier
我想问一下如何locationIdentifier使用JPQL 访问?
对不起我的英语不好.提前致谢!
jpql ×1