Maven + Spring + Hibernate: hibernate3-maven-plugin hbm2ddl fails for reason “Caused by: java.lang.NullPointerException”

前端 未结 2 1433
天命终不由人
天命终不由人 2021-01-06 21:33

I had to downgrade Hibernate from version 4 to version 3 (3.3.2.GA to be specific), due to current lack of support for Hibernate 4 within Spring, and now the project fails t

2条回答
  •  情书的邮戳
    2021-01-06 22:01

    I faced the same problem while trying to make maven bootstrap a database from a hibernate model (issue described in Generate database schema (Hibernate) on maven test).

    I got hbm2ddl working quite well with the following combination of versions: Hibernate (runtime): 4.1.7.Final hibernate3-maven-plugin: 3.6.10.Final, specified plugin version 2.2 hibernate3-maven-plugin's hibernate-validator dependency: 4.2.0.Final

    Below the relevant parts of the pom:

    Versions:

    
    
        4.1.7.Final
        3.6.10.Final
    
    
    

    hibernate3-maven-plugin's definition:

    
        
            
                org.codehaus.mojo
                hibernate3-maven-plugin
                2.2
                
                    
                        
                            hbm2ddl
                            jpaconfiguration
                        
    
                    
    
                    
                        schema.ddl
                        true
                        false
                        true
                        false
                        true
                        target/test-classes/application.properties
                        ${skipTests}
                    
                
                
                    
                        process-classes
                        
                            hbm2ddl
                        
                    
                
                
                    
                        org.hibernate
                        hibernate-entitymanager
                        ${hibernate.maven.plugin.version}
                        
                            
                                cglib
                                cglib
                            
                            
                                commons-logging
                                commons-logging
                            
                        
                    
                    
                        org.hibernate
                        hibernate-core
                        ${hibernate.maven.plugin.version}
                        
                            
                                cglib
                                cglib
                            
                            
                                commons-logging
                                commons-logging
                            
                        
                    
                    
                        org.hibernate
                        hibernate-validator
                        4.2.0.Final
                    
    
                
            
    
        
    
    

    Runtime dependencies:

    
    
        
            org.hibernate
            hibernate-core
            ${org.hibernate.version}
        
    
        
            org.hibernate
            hibernate-entitymanager
            ${org.hibernate.version}
        
    
    

    I hope this helps.

提交回复
热议问题