//增加
//此處必須手動添加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 企業(yè)類型-分類2 企業(yè)類型-類型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
各位慕友幫忙看看哦,謝謝,這是什么問題呢?
瘋子520520
2016-09-01 20:03:03