Access field with @Transient in JPA query
问题 I have an entity with a transient attribute: @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] } I tried to access locationIdentifier this way in JPA: String sqlString = "SELECT asset FROM Asset WHERE asset.locationIdentifier = :inputstr"; Query query = entityManager.createQuery