//增加
//此处必须手动添加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 implementationSLF4J: 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 logVersionINFO: HHH000412: Hibernate Core {4.1.4.Final}2016-9-1 19:51:51 org.hibernate.cfg.Environment <clinit>INFO: HHH000206: hibernate.properties not found2016-9-1 19:51:51 org.hibernate.cfg.Environment buildBytecodeProviderINFO: HHH000021: Bytecode provider name : javassist2016-9-1 19:51:51 org.hibernate.cfg.Configuration configureINFO: HHH000043: Configuring from resource: /hibernate.cfg.xml2016-9-1 19:51:51 org.hibernate.cfg.Configuration getConfigurationInputStreamINFO: HHH000040: Configuration resource: /hibernate.cfg.xml2016-9-1 19:51:51 org.hibernate.cfg.Configuration addResourceINFO: HHH000221: Reading mappings from resource: fz/po/sjzdxx.hbm.xml2016-9-1 19:51:51 org.hibernate.cfg.Configuration addResourceINFO: HHH000221: Reading mappings from resource: fz/po/sjzdfl.hbm.xml2016-9-1 19:51:51 org.hibernate.cfg.Configuration doConfigureINFO: HHH000041: Configured SessionFactory: null2016-9-1 19:51:51 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configureINFO: HHH000402: Using Hibernate built-in connection pool (not for production use!)2016-9-1 19:51:51 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configureINFO: HHH000115: Hibernate connection pool size: 202016-9-1 19:51:51 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configureINFO: HHH000006: Autocommit mode: false2016-9-1 19:51:51 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configureINFO: 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 configureINFO: HHH000046: Connection properties: {user=root, password=****}2016-9-1 19:51:52 org.hibernate.dialect.Dialect <init>INFO: HHH000400: Using dialect: org.hibernate.dialect.MySQLDialect2016-9-1 19:51:52 org.hibernate.engine.transaction.internal.TransactionFactoryInitiator initiateServiceINFO: 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
添加回答
举报
0/150
提交
取消