0

我可以映射一个字段瞬态。结果映射狗为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;

}
4

1 回答 1

-2

@Transient如果您想阅读它,请不要这样做。

于 2012-12-12T16:03:11.247 回答