1

我无法让休眠连接正常工作!我正在使用 Hibernate 4.2.1 我收到此错误

初始 SessionFactory 创建 failed.org.hibernate.cfg.beanvalidation.IntegrationException:激活 Bean 验证集成时出错

public class HibernateUtil {

    private static final SessionFactory sessionFactory;
    private static ServiceRegistry serviceRegistry;

    static {
                   try {

                                   Configuration configuration = new Configuration();
                       configuration.configure();
                       serviceRegistry = new ServiceRegistryBuilder().applySettings(configuration.getProperties()).buildServiceRegistry();        
                       sessionFactory = configuration.buildSessionFactory(serviceRegistry);
                   } catch (Throwable ex) {
                                   System.err.println("Initial SessionFactory creation failed." + ex);
                                   throw new ExceptionInInitializerError(ex);
                   }
    }              

    public static SessionFactory getSessionFactory() {
                   return sessionFactory;
    }
}

这里我的日志:

16 mai 2013 10:27:14 org.hibernate.annotations.common.Version <clinit>
INFO: HCANN000001: Hibernate Commons Annotations {4.0.1.Final}
16 mai 2013 10:27:14 org.hibernate.Version logVersion
INFO: HHH000412: Hibernate Core {4.2.1.Final}
16 mai 2013 10:27:14 org.hibernate.cfg.Environment <clinit>
INFO: HHH000206: hibernate.properties not found
16 mai 2013 10:27:14 org.hibernate.cfg.Environment buildBytecodeProvider
INFO: HHH000021: Bytecode provider name : javassist
16 mai 2013 10:27:14 org.hibernate.cfg.Configuration configure
INFO: HHH000043: Configuring from resource: /hibernate.cfg.xml
16 mai 2013 10:27:14 org.hibernate.cfg.Configuration getConfigurationInputStream
INFO: HHH000040: Configuration resource: /hibernate.cfg.xml
16 mai 2013 10:27:14 org.hibernate.internal.util.xml.DTDEntityResolver resolveEntity
WARN: HHH000223: Recognized obsolete hibernate namespace                     http://hibernate.sourceforge.net/. Use namespace http://www.hibernate.org/dtd/ instead. Refer to Hibernate 3.6 Migration Guide!
16 mai 2013 10:27:14 org.hibernate.cfg.Configuration doConfigure
INFO: HHH000041: Configured SessionFactory: null
16 mai 2013 10:27:15         org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000402: Using Hibernate built-in connection pool (not for production use!)
16 mai 2013 10:27:15     org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000115: Hibernate connection pool size: 20
16 mai 2013 10:27:15     org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000006: Autocommit mode: false
16 mai 2013 10:27:15 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000401: using driver [org.postgresql.Driver] at URL [jdbc:postgresql://localhost:5432/portail]
16 mai 2013 10:27:15 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000046: Connection properties: {user=postgres, password=****}
16 mai 2013 10:27:15 org.hibernate.dialect.Dialect <init>
INFO: HHH000400: Using dialect: org.hibernate.dialect.HSQLDialect
16 mai 2013 10:27:15 org.hibernate.engine.jdbc.internal.LobCreatorBuilder     useContextualLobCreation
INFO: HHH000424: Disabling contextual LOB creation as createClob() method threw error :     java.lang.reflect.InvocationTargetException
16 mai 2013 10:27:15     org.hibernate.engine.transaction.internal.TransactionFactoryInitiator initiateService
INFO: HHH000399: Using default transaction strategy (direct JDBC transactions)
16 mai 2013 10:27:15 org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory <init>
INFO: HHH000397: Using ASTQueryTranslatorFactory
Initial SessionFactory creation     failed.org.hibernate.cfg.beanvalidation.IntegrationException: Error activating Bean     Validation integration
4

1 回答 1

1

已修复,我必须添加 Hibernate Validator

于 2013-05-21T09:38:57.120 回答