我有一个实体类:
public class Customer implements Serializable {
private static final long serialVersionUID = 1L;
@XmlTransient
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "CUSTOMER_ID")
private Integer customerId;
@Basic(optional = false)
@NotNull
@Size(min = 1, max = 30)
@Column(name = "NAME")
private String name;
@Basic(optional = false)
@NotNull
@Size(min = 1, max = 30)
@Column(name = "ADDRESSLINE1")
private String addressline1;
@Basic(optional = false)
.
.
.
.
我通过 jax-ws Web 服务中的 xml 发送了一个类的对象,如下所示:
<addressline1>xx</addressline1><addressline2>xx</addressline2><city>xx</city><country>xx</country><creditLimit>xx</creditLimit><customerId>xx</customerId><email>xx</email><name>xx</name><owner>xx</owner><phone>xx</phone><province>xx</province><zip>xx</zip>
是否可以不发送客户不应该看到的变量之一,例如 customerId?我添加了@XmlTransient,但没有任何变化。