第一个hibernate程序,成功运行,但是出现很多INFO 和warn ,但是没有Exception

进击的拖拉机 发布于 2014/12/02 19:10
阅读 822
收藏 0

主程序

import org.hibernate.Session;

import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
import org.lucu.Student;

public class StudentTest {


        public static void main(String[] args) {
            try{

                    Student st = new Student();
                    st.setId(7);
                    st.setAge(22);
                    st.setName("luochuan");


                    Configuration cfg = new Configuration();
                    SessionFactory sf = cfg.configure(). buildSessionFactory();    // 这里显示deprecated 

                    Session session = sf.openSession();
                    session.beginTransaction();
                    session.save(st);
                    session.getTransaction().commit();
                    session.close();
                    sf.close();
                }catch(Exception e){
                e.printStackTrace();
                }
        }

}

这里是运行结果:

2014-12-2 18:50:24 org.hibernate.annotations.common.reflection.java.JavaReflectionManager <clinit>
INFO: HCANN000001: Hibernate Commons Annotations {4.0.5.Final}
2014-12-2 18:50:24 org.hibernate.Version logVersion
INFO: HHH000412: Hibernate Core {4.3.7.Final}
2014-12-2 18:50:24 org.hibernate.cfg.Environment <clinit>
INFO: HHH000206: hibernate.properties not found
2014-12-2 18:50:24 org.hibernate.cfg.Environment buildBytecodeProvider
INFO: HHH000021: Bytecode provider name : javassist
2014-12-2 18:50:24 org.hibernate.cfg.Configuration configure
INFO: HHH000043: Configuring from resource: /hibernate.cfg.xml
2014-12-2 18:50:24 org.hibernate.cfg.Configuration getConfigurationInputStream
INFO: HHH000040: Configuration resource: /hibernate.cfg.xml
2014-12-2 18:50:24 org.hibernate.cfg.Configuration addResource
INFO: HHH000221: Reading mappings from resource: org/lucu/Student.hbm.xml
2014-12-2 18:50:24 org.hibernate.cfg.Configuration doConfigure
INFO: HHH000041: Configured SessionFactory: null
2014-12-2 18:50:24 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
WARN: HHH000402: Using Hibernate built-in connection pool (not for production use!)
2014-12-2 18:50:24 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator
INFO: HHH000401: using driver [com.mysql.jdbc.Driver] at URL [jdbc:mysql://localhost/hibernate]
2014-12-2 18:50:24 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator
INFO: HHH000046: Connection properties: {user=root, password=****}
2014-12-2 18:50:24 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator
INFO: HHH000006: Autocommit mode: false
2014-12-2 18:50:24 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000115: Hibernate connection pool size: 20 (min=1)
2014-12-2 18:50:25 org.hibernate.dialect.Dialect <init>
INFO: HHH000400: Using dialect: org.hibernate.dialect.MySQLDialect
2014-12-2 18:50:25 org.hibernate.engine.transaction.internal.TransactionFactoryInitiator initiateService
INFO: HHH000399: Using default transaction strategy (direct JDBC transactions)
2014-12-2 18:50:25 org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory <init>
INFO: HHH000397: Using ASTQueryTranslatorFactory
Hibernate: insert into Student (age, name, id) values (?, ?, ?)
2014-12-2 18:50:26 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl stop
INFO: HHH000030: Cleaning up connection pool [jdbc:mysql://localhost/hibernate]


请问高手们,这里是由于使用buildSessionFactory()方法的原因,还是因为jar包版本不搭配的问题,亦或其他问题导致这样的结果?

菜鸟谢谢了。

加载中
0
魔法刀客
魔法刀客

WARN: HHH000402: Using Hibernate built-in connection pool (not for production use!)

正在使用 hibernate 内置的连接池 (不要在生产使用!) 

进击的拖拉机
代码里似乎并没有用到连接池。请问有解决问题的办法么?
0
语博兄
语博兄
我的也是这样,我一直没管,以为是新的IDE的设置的问题,请问你现在搞定了么?贴个答案出来大家参考下吧》》
进击的拖拉机
那是日志信息,不用太在意。只需要在乎error 或者 warning 就行了。希望能够帮到你。
返回顶部
顶部