gpt4 book ai didi

java - hibernate 执行延迟

转载 作者:行者123 更新时间:2023-11-30 23:06:20 24 4
gpt4 key购买 nike

帖子的名字可能很奇怪,但我不知道怎么调用它。

每次我与数据库 (MYSQL) 交互时,我都会得到此输出,然后执行。

这些消息导致执行延迟,我真的很讨厌它。我该如何解决这个问题并立即开始执行?

Feb 12, 2014 7:37:04 PM org.hibernate.annotations.common.Version <clinit>
INFO: HCANN000001: Hibernate Commons Annotations {4.0.2.Final}
Feb 12, 2014 7:37:04 PM org.hibernate.Version logVersion
INFO: HHH000412: Hibernate Core {4.2.2.Final}
Feb 12, 2014 7:37:04 PM org.hibernate.cfg.Environment <clinit>
INFO: HHH000206: hibernate.properties not found
Feb 12, 2014 7:37:04 PM org.hibernate.cfg.Environment buildBytecodeProvider
INFO: HHH000021: Bytecode provider name : javassist
Feb 12, 2014 7:37:04 PM org.hibernate.cfg.Configuration configure
INFO: HHH000043: Configuring from resource: /main/hibernate.cfg.xml
Feb 12, 2014 7:37:04 PM org.hibernate.cfg.Configuration getConfigurationInputStream
INFO: HHH000040: Configuration resource: /main/hibernate.cfg.xml
Feb 12, 2014 7:37:05 PM org.hibernate.cfg.Configuration doConfigure
INFO: HHH000041: Configured SessionFactory:
Feb 12, 2014 7:37:05 PM org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000402: Using Hibernate built-in connection pool (not for production use!)
Feb 12, 2014 7:37:05 PM org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000115: Hibernate connection pool size: 20
Feb 12, 2014 7:37:05 PM org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000006: Autocommit mode: false
Feb 12, 2014 7:37:05 PM org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000401: using driver [com.mysql.jdbc.Driver] at URL [jdbc:mysql://localhost:3306/testing]
Feb 12, 2014 7:37:05 PM org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000046: Connection properties: {user=root, password=****}
Feb 12, 2014 7:37:06 PM org.hibernate.dialect.Dialect <init>
INFO: HHH000400: Using dialect: org.hibernate.dialect.MySQLDialect
Feb 12, 2014 7:37:07 PM org.hibernate.engine.transaction.internal.TransactionFactoryInitiator initiateService
INFO: HHH000399: Using default transaction strategy (direct JDBC transactions)
Feb 12, 2014 7:37:07 PM org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory <init>
INFO: HHH000397: Using ASTQueryTranslatorFactory
Feb 12, 2014 7:37:07 PM org.hibernate.validator.internal.util.Version <clinit>
INFO: HV000001: Hibernate Validator 5.0.2.Final
Feb 12, 2014 7:37:09 PM org.hibernate.search.Version <clinit>
INFO: HSEARCH000034: Hibernate Search 4.3.0.Final
Feb 12, 2014 7:37:09 PM org.hibernate.search.impl.ConfigContext getLuceneMatchVersion
WARN: HSEARCH000075: Configuration setting hibernate.search.lucene_version was not specified, using LUCENE_CURRENT.
Feb 12, 2014 7:37:11 PM org.hibernate.internal.SessionFactoryRegistry addSessionFactory
WARN: HHH000277: Could not bind factory to JNDI
org.hibernate.service.jndi.JndiException: Error parsing JNDI name []
at org.hibernate.service.jndi.internal.JndiServiceImpl.parseName(JndiServiceImpl.java:92)
at org.hibernate.service.jndi.internal.JndiServiceImpl.bind(JndiServiceImpl.java:108)
at org.hibernate.internal.SessionFactoryRegistry.addSessionFactory(SessionFactoryRegistry.java:89)
at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:480)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1769)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1840)
at controller.DAO.<clinit>(DAO.java:57)
at main.Main.main(Main.java:92)
Caused by: javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
at javax.naming.InitialContext.getURLOrDefaultInitCtx(Unknown Source)
at javax.naming.InitialContext.getNameParser(Unknown Source)
at org.hibernate.service.jndi.internal.JndiServiceImpl.parseName(JndiServiceImpl.java:86)
... 7 more</code>

最佳答案

您看到的是 hibernate 初始化。通过查看它,核心 hibernate 似乎在 3 秒内启动(7:37:04 - 7:37:07),您还有额外的 4 秒来初始化 hibernate 搜索和 validator 。你在使用 hibernate 搜索和 validator 吗?也许您可以在您的配置中禁用它们。

关于java - hibernate 执行延迟,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21735561/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com