//增加 //此处必须手动添加id后才可调用save方法进行储存~~为什么呢?为什么有些不用呢?又该怎么添加? // sjzdflDAO sjzdfldao = new sjzdflDAO(); // sjzdfl sjzdfl0 = new sjzdfl(); // sjzdfl0.setSjzdflid(9);//这个样子加指定id,可是问题又来了,添加到的名称显示是??????怎么回事呢? // sjzdfl0.setSjzdflmc("测试数据字典分类"); // Transaction transaction = HibernateSessionFactory.getSession().beginTransaction(); // sjzdfldao.save(sjzdfl0); // transaction.commit(); //更新 <跟增加一样,在数据库中“测试”被“??”代替显示了 sjzdflDAO sjzdfldao = new sjzdflDAO(); sjzdfl sjzdfl0 = new sjzdfl(); sjzdfl0.setSjzdflid(9); sjzdfl0.setSjzdflmc("测试"); Transaction transaction = HibernateSessionFactory.getSession().beginTransaction(); sjzdfldao.attachDirty(sjzdfl0); transaction.commit();
在数据库管理工具的显示是:
1 企业类型-分类
2 企业类型-类型
3 开户银行-分类
4 信息来源-分类
5 客户满意度-分类
9 ??
添加的9号,显示的为什么是??呢
错误信息:
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
2016-9-1 19:51:51 org.hibernate.annotations.common.Version <clinit>
INFO: HCANN000001: Hibernate Commons Annotations {4.0.1.Final}
2016-9-1 19:51:51 org.hibernate.Version logVersion
INFO: HHH000412: Hibernate Core {4.1.4.Final}
2016-9-1 19:51:51 org.hibernate.cfg.Environment <clinit>
INFO: HHH000206: hibernate.properties not found
2016-9-1 19:51:51 org.hibernate.cfg.Environment buildBytecodeProvider
INFO: HHH000021: Bytecode provider name : javassist
2016-9-1 19:51:51 org.hibernate.cfg.Configuration configure
INFO: HHH000043: Configuring from resource: /hibernate.cfg.xml
2016-9-1 19:51:51 org.hibernate.cfg.Configuration getConfigurationInputStream
INFO: HHH000040: Configuration resource: /hibernate.cfg.xml
2016-9-1 19:51:51 org.hibernate.cfg.Configuration addResource
INFO: HHH000221: Reading mappings from resource: fz/po/sjzdxx.hbm.xml
2016-9-1 19:51:51 org.hibernate.cfg.Configuration addResource
INFO: HHH000221: Reading mappings from resource: fz/po/sjzdfl.hbm.xml
2016-9-1 19:51:51 org.hibernate.cfg.Configuration doConfigure
INFO: HHH000041: Configured SessionFactory: null
2016-9-1 19:51:51 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000402: Using Hibernate built-in connection pool (not for production use!)
2016-9-1 19:51:51 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000115: Hibernate connection pool size: 20
2016-9-1 19:51:51 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000006: Autocommit mode: false
2016-9-1 19:51:51 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000401: using driver [com.mysql.jdbc.Driver] at URL [jdbc:mysql://localhost:3306/beifengcrm]
2016-9-1 19:51:51 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000046: Connection properties: {user=root, password=****}
2016-9-1 19:51:52 org.hibernate.dialect.Dialect <init>
INFO: HHH000400: Using dialect: org.hibernate.dialect.MySQLDialect
2016-9-1 19:51:52 org.hibernate.engine.transaction.internal.TransactionFactoryInitiator initiateService
INFO: HHH000399: Using default transaction strategy (direct JDBC transactions)
2016-9-1 19:51:52 org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory <init>
INFO: HHH000397: Using ASTQueryTranslatorFactory
阿旭_
Zmorn
疯子520520
相关分类