我可以映射场瞬态。 映射狗的结果为null,如何实现映射。
@Entity
@SqlResultSetMapping(name = "DogMapping",
entities = {
@EntityResult(entityClass = Dog.class, fields = {
@FieldResult(name = "Id", column = "ID"),
@FieldResult(name = "name", column = "NAME"),
})
}))
public class Dog implements Serializable {
@Id
private Long id;
@Transient
private String name;
}
答案 0 :(得分:-1)
如果你想阅读它,请不要使它@Transient
。