2011-10-14 35 views
0

調用的getter我面對下面org.springframework.orm.hibernate3.HibernateSystemException:拋出:IllegalArgumentException發生的

IllegalArgumentException occurred calling getter of org.springframework.security.oauth.examples.sparklr.models.Authority.user; 
nested exception is org.hibernate.PropertyAccessException: 
IllegalArgumentException occurred calling getter of org.springframework.security.oauth.examples.sparklr.models.Authority.user 

我的Hibernate依賴所示的一個問題是:

  • 休眠核心3.3.2.GA
  • 休眠的註解3.4.0.GA
  • 休眠公地的註解3.3.0.ga
  • 的Hibernate的EntityManager 3.4.0.GA
public class User implements UserDetails,Serializable { 

    /** Serial Version UID. */ 
    private static final long serialVersionUID = -558892839L; 

    /** Use a WeakHashMap so entries will be garbage collected once all entities 
     referring to a saved hash are garbage collected themselves. */ 
    private static final Map<Serializable, String> SAVED_HASHES = 
     Collections.synchronizedMap(new WeakHashMap<Serializable, String>()); 

    /** hashCode temporary storage. */ 
    private volatile String hashCode; 


    /** Field mapping. */ 
    private Boolean accountnonexpired; 
    /** Field mapping. */ 
    private Boolean accountnonlocked; 
    /** Field mapping. */ 
    private List<Authority> authorities = new ArrayList<Authority>(); 

    /** Field mapping. */ 
    private Boolean credentialsnonexpired; 
    /** Field mapping. */ 
    private Boolean enabled; 
    /** Field mapping. */ 
    private String id; 
    /** Field mapping. */ 
    private String password; 


     public class Authority implements Serializable ,GrantedAuthority { 


    /** Serial Version UID. */ 
    private static final long serialVersionUID = -558892840L; 

    /** Use a WeakHashMap so entries will be garbage collected once all entities 
     referring to a saved hash are garbage collected themselves. */ 
    private static final Map<Serializable, Serializable> SAVED_HASHES = 
     Collections.synchronizedMap(new WeakHashMap<Serializable, Serializable>()); 

    /** hashCode temporary storage. */ 
    private volatile Serializable hashCode; 


    /** Field mapping. */ 
    private String authority; 
    /** Field mapping. */ 
    private User user; 

我該如何解決非常感謝你

+0

你還沒有向我們展示了'org.springframework.security.oauth.examples.sparklr.models.Authority'類,這似乎是例外的來源。 –

+0

我張貼在我的權威類下面,你可以看一下,謝謝 –

回答

0

從你所示的代碼,你不必爲Authorityuser屬性爲getter 。

嘗試增加

public User getUser(){ 
    return this.user; 
} 
+0

我有,但我不能複製所有的代碼,因爲公司的限制,它阻止@ManyToOne(cascade = {CascadeType.PERSIST,CascadeType.MERGE},fetch = FetchType。懶惰) \t @ org.hibernate.annotations.Cascade({org.hibernate.annotations.CascadeType.SAVE_UPDATE}) \t @JoinColumn(名稱= 「用戶」,可爲空=假) @Id \t公衆用戶的getUser() { \t \t return this.user; \t \t \t} –

+0

iam不確定hibernate的版本,可以嗎? –

+0

當我用hsqldb 2.0.0,hibernate-jmx 3.5.4-Final,hibernate-annotations 3.3.0.ga,hibernate-commons-annotations 3.3.0.ga,javassist 3.4.GA更改這些依賴關係時,我遇到了下面的錯誤java.lang.IncompatibleClassChangeError:類org.hibernate.cfg.ExtendedMapping 具有接口org.hibernate.cfg.Mappings作爲超類-------如果我添加hibernate-entitymanager 3.4.0.GA其他錯誤是相同的IllegalArgumentException發生呼籲吸氣劑---與第一我不明白 –

相關問題