2016-04-23 68 views
2

我正在編寫REST服務。我有班主任。它有財產密碼。用@JsonIgnore註解的屬性密碼。如何更新除註釋之外的對象的所有屬性@JsonIgnore

public class Manager implements UserDetails { 
@Id @GeneratedValue 
private int id; 

private boolean accountNonExpired; 
private boolean accountNonLocked; 
private List<Authority> authorities; 
private boolean credentialsNonExpired; 
private boolean enabled; 
private String firstName; 
private String lastName; 
private String phone; 
@JsonIgnore 
private String password; 
... 

當我從客戶端獲取對象時,它不包含密碼。我該怎麼做 使用Hibernate更新除註釋@JsonIgnore之外的對象的所有字段?

public void update(Manager manager){ 
    Session session = sessionFactory.openSession(); 
    Transaction tx = session.beginTransaction(); 
    session.update(manager); 
    tx.commit(); 
    session.close();   
} 

回答

相關問題