2011-09-10 11 views
1

どうすればこの例外を解決できますか? 例外:注釈付きスプリングと休止状態の統合PojoEntityTuplizer

 Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [com/home/app/database/Hibernate-ctx.xml]: 
     Invocation of init method failed; nested exception is org.hibernate.HibernateException: Unable to instantiate default tuplizer [org.hibernate.tuple.entity.PojoEntityTuplizer] 
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1420) 
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519) 
      at org.spr...... 
Caused by: org.hibernate.HibernateException: Unable to instantiate default tuplizer [org.hibernate.tuple.entity.PojoEntityTuplizer] 
    at org.hibernate.tuple.entity.EntityTuplizerFactory.constructTuplizer(EntityTuplizerFactory.java:108) 
    at org.hibernate.tuple.entity.EntityTuplizerFactory.constructDefaultTuplizer(EntityTuplizerFactory.java:133) 

モデルクラス:

@Entity 
@Table(name = "LOGIN") 
public class UserLogin extends Home implements Serializable { 

    private static final long serialVersionUID = 1L; 
    private Integer loginID; 
    private String loginName; 
    private String loginPassword; 

    public UserLogin() { 
    } 

    @Id 
    @GeneratedValue(strategy = GenerationType.IDENTITY) 
    @Column(name = "LOGIN_ID") 
    public Integer getLoginID() { 
     return this.loginID; 
    } 

    @Column(name = "LOGIN_NAME") 
    public String getLoginName() { 
     return loginName; 
    } 

    @Column(name = "LOGIN_PASSWORD") 
    public String getLoginPassword() { 
     return loginPassword; 
    } 

、それがsetterメソッドを対応です。

春のコンテキストファイル:MySQLで

<context:annotation-config /> 
     <context:component-scan base-package="com.home.app" /> 
     <bean id="sessionFactory" 
      class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">   
        <property name="dataSource"> 
         <ref bean="dataSource" /> 
        </property> 

... 

    <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"> 
      <property name="driverClassName" value="${jdbc.driverClassName}" /> 
      <property name="url" value="${jdbc.url}" /> 
      <property name="username" value="${jdbc.username}" /> 
      <property name="password" value="${jdbc.password}" /> 
     </bean> 

クエリ:

CREATE TABLE LOGIN 
(
LOGIN_NAME varchar(255), 
LOGIN_PASSWORD varchar(255), 
LOGIN_ID int(11) not null 
); 

DAOクラス:

public class LoginDetailsDAOImpl implements LoginDetailsDAO { 
    HibernateTemplate hibernateTemplate; 

    public void setSessionFactory(SessionFactory sessionFactory) { 
     this.hibernateTemplate = new HibernateTemplate(sessionFactory); 
    } 

    @Transactional(readOnly = true) 
    public List<UserLogin> loginDetails(UserLogin login) { 

     return hibernateTemplate.find("from Login"); 
    } 
} 

答えて

4

ダウンロードは、あなたのクラスパスにJavaassistジャーを追加し、それをテストします。

Mavenの依存関係:

<dependency> 
    <groupId>javassist</groupId> 
    <artifactId>javassist</artifactId> 
    <version>3.12.1.GA</version> 
</dependency> 
関連する問題