mmlhw 2015-09-20 01:56
浏览 957
已结题

SchemaExport export自动创建表失败

package entity;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
import org.hibernate.service.ServiceRegistry;
import org.hibernate.service.ServiceRegistryBuilder;
import org.hibernate.tool.hbm2ddl.SchemaExport;
import org.junit.Test;

public class TestStudents {

@Test
public void testSchemaExport()
{
//创建配置对象
Configuration config = new Configuration().configure();
//创建服务注册对象
ServiceRegistry serviceRegistry = new ServiceRegistryBuilder().applySettings(config.getProperties()).buildServiceRegistry();
//创建sessionFactory
SessionFactory sessionFactory = config.buildSessionFactory(serviceRegistry);
//创建session对象
Session session = sessionFactory.getCurrentSession();
//创建SchemaExport对象
SchemaExport export = new SchemaExport(config);

export.create(true, true);

}
}

九月 20, 2015 2:40:45 上午 org.hibernate.annotations.common.Version
INFO: HCANN000001: Hibernate Commons Annotations {4.0.2.Final}
九月 20, 2015 2:40:46 上午 org.hibernate.Version logVersion
INFO: HHH000412: Hibernate Core {4.2.4.Final}
九月 20, 2015 2:40:46 上午 org.hibernate.cfg.Environment
INFO: HHH000206: hibernate.properties not found
九月 20, 2015 2:40:46 上午 org.hibernate.cfg.Environment buildBytecodeProvider
INFO: HHH000021: Bytecode provider name : javassist
九月 20, 2015 2:40:46 上午 org.hibernate.cfg.Configuration configure
INFO: HHH000043: Configuring from resource: /hibernate.cfg.xml
九月 20, 2015 2:40:46 上午 org.hibernate.cfg.Configuration getConfigurationInputStream
INFO: HHH000040: Configuration resource: /hibernate.cfg.xml
九月 20, 2015 2:40:46 上午 org.hibernate.cfg.Configuration addResource
INFO: HHH000221: Reading mappings from resource: entity/Students.hbm.xml
九月 20, 2015 2:40:46 上午 org.hibernate.cfg.Configuration addResource
INFO: HHH000221: Reading mappings from resource: entity/Users.hbm.xml
九月 20, 2015 2:40:46 上午 org.hibernate.cfg.Configuration doConfigure
INFO: HHH000041: Configured SessionFactory: null
九月 20, 2015 2:40:46 上午 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000402: Using Hibernate built-in connection pool (not for production use!)
九月 20, 2015 2:40:46 上午 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000115: Hibernate connection pool size: 20
九月 20, 2015 2:40:46 上午 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000006: Autocommit mode: false
九月 20, 2015 2:40:46 上午 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000401: using driver [com.mysql.jdbc.Driver] at URL [jdbc:mysql:///test?useUnicode=true&characterEncoding=UTF-8]
九月 20, 2015 2:40:46 上午 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000046: Connection properties: {user=root, password=****}
九月 20, 2015 2:40:46 上午 org.hibernate.engine.jdbc.internal.JdbcServicesImpl configure
WARN: HHH000342: Could not obtain connection to query metadata : Access denied for user 'root'@'localhost' (using password: NO)
九月 20, 2015 2:40:46 上午 org.hibernate.dialect.Dialect
INFO: HHH000400: Using dialect: org.hibernate.dialect.MySQLDialect
九月 20, 2015 2:40:46 上午 org.hibernate.engine.jdbc.internal.LobCreatorBuilder useContextualLobCreation
INFO: HHH000422: Disabling contextual LOB creation as connection was null
九月 20, 2015 2:40:46 上午 org.hibernate.engine.transaction.internal.TransactionFactoryInitiator initiateService
INFO: HHH000399: Using default transaction strategy (direct JDBC transactions)
九月 20, 2015 2:40:46 上午 org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory
INFO: HHH000397: Using ASTQueryTranslatorFactory

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 求差集那个函数有问题,有无佬可以解决
    • ¥15 【提问】基于Invest的水源涵养
    • ¥20 微信网友居然可以通过vx号找到我绑的手机号
    • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
    • ¥15 解riccati方程组
    • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
    • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
    • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
    • ¥50 树莓派安卓APK系统签名
    • ¥65 汇编语言除法溢出问题