我在用ssh架构开发一个小项目,当执行插入数据的时候,
控制台没有报错hibernate也提示出正确的sql语气,
但是mysql数据库中并没有插入数据,有没有人知道是怎么回事啊?
是项目中什么东西没有配好呢?
还是其他什么原因啊?希望大家多提建议啊!!!
急!!

解决方案 »

  1.   

    此回复为自动发出,仅用于显示而已,并无任何其他特殊作用
    楼主【gdf520】截止到2008-08-02 23:27:51的历史汇总数据(不包括此帖):
    发帖的总数量:1                        发帖的总分数:20                       每贴平均分数:20                       
    回帖的总数量:1                        得分贴总数量:0                        回帖的得分率:0%                       
    结贴的总数量:1                        结贴的总分数:20                       
    无满意结贴数:0                        无满意结贴分:0                        
    未结的帖子数:0                        未结的总分数:0                        
    结贴的百分比:100.00%               结分的百分比:100.00%                  
    无满意结贴率:0.00  %               无满意结分率:0.00  %                  
    敬礼!

    取消马甲机器人,请点这里:http://www.java2000.net/mycsdn/robotStop.jsp?usern=gdf520
      

  2.   

    tx.commit();还要看看配置文件 绑定没有
      

  3.   

    事务提交后,关闭session试试。
    要是还不行的话,应该是缓存的问题吧,过一段时间应该就能看到插入的效果啦
      

  4.   

    开发时把日志级别设置到debug或info。
      

  5.   

    我把日志的级别设置为debug后,下面的是提示,好像没有什么错误02:49:40,932  INFO TransactionFactoryFactory:31 - Using default transaction strategy (direct JDBC transactions)
    02:49:40,932  INFO TransactionManagerLookupFactory:33 - No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
    02:49:40,942  INFO ASTQueryTranslatorFactory:24 - Using ASTQueryTranslatorFactory
    02:49:41,623  INFO SchemaUpdate:115 - Running hbm2ddl schema update
    02:49:41,633  INFO SchemaUpdate:126 - fetching database metadata
    02:49:41,643  INFO SchemaUpdate:138 - updating schema
    02:49:41,933  INFO TableMetadata:39 - table found: crm.t_contactperson
    02:49:41,933  INFO TableMetadata:40 - columns: [type, officephone, customer, homeaddress, msn, grade, fax, id, department, sex, responsibility, term, cellphone, description, preference, email, homephone, name, duty, birthday]
    02:49:41,943  INFO TableMetadata:42 - foreign keys: [fk9bc7f2ca6a119503]
    02:49:41,943  INFO TableMetadata:43 - indexes: [primary, fk9bc7f2ca6a119503]
    02:49:42,263  INFO TableMetadata:39 - table found: crm.t_customer
    02:49:42,284  INFO TableMetadata:40 - columns: [phone, customercategory, address, province, fax, id, sex, industry, postcode, name, city, evaluation, type, owner, currentstatus, relationrating, sn, employeesize, country, creditrating, site, description, shortname, shared, source, createtime, parent]
    02:49:42,284  INFO TableMetadata:42 - foreign keys: [fk557a3389c70d2f45, fk557a3389a9b1dcf]
    02:49:42,294  INFO TableMetadata:43 - indexes: [fk557a3389c70d2f45, primary, fk557a3389a9b1dcf]
    02:49:42,434  INFO TableMetadata:39 - table found: crm.t_dictionary
    02:49:42,434  INFO TableMetadata:40 - columns: [code, text, category, id]
    02:49:42,434  INFO TableMetadata:42 - foreign keys: []
    02:49:42,434  INFO TableMetadata:43 - indexes: [primary]
    02:49:42,504  INFO TableMetadata:39 - table found: crm.t_user
    02:49:42,504  INFO TableMetadata:40 - columns: [password, username, id]
    02:49:42,554  INFO TableMetadata:42 - foreign keys: []
    02:49:42,554  INFO TableMetadata:43 - indexes: [primary]
    02:49:42,584  INFO SchemaUpdate:160 - schema update complete
    02:49:44,036 DEBUG JDBCTransaction:54 - begin
    02:49:44,036 DEBUG ConnectionManager:421 - opening JDBC connection
    02:49:44,036 DEBUG JDBCTransaction:59 - current autocommit status: false
    02:49:44,056 DEBUG JDBCContext:214 - after transaction begin
    02:49:44,947 DEBUG AbstractBatcher:366 - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
    02:49:44,967 DEBUG ConnectionManager:421 - opening JDBC connection
    02:49:44,967 DEBUG SQL:401 - insert into T_User (username, password) values (?, ?)
    Hibernate: insert into T_User (username, password) values (?, ?)
    02:49:44,977 DEBUG AbstractBatcher:484 - preparing statement
    02:49:46,560 DEBUG AbstractBatcher:374 - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
    02:49:46,560 DEBUG AbstractBatcher:533 - closing statement
    02:49:46,820 DEBUG ConnectionManager:469 - registering flush begin
    02:49:46,830 DEBUG ConnectionManager:478 - registering flush end
    02:49:46,830 DEBUG ConnectionManager:380 - performing cleanup
    02:49:46,850 DEBUG ConnectionManager:441 - releasing JDBC connection [ (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)]
    02:49:46,860 DEBUG JDBCContext:219 - after transaction completion
    02:49:46,860 DEBUG ConnectionManager:302 - transaction completed on session with on_close connection release mode; be sure to close the session to release JDBC resources!
    02:49:47,040 DEBUG JDBCTransaction:103 - commit
    02:49:47,050 DEBUG JDBCContext:205 - before transaction completion
    02:49:47,070 DEBUG JDBCTransaction:116 - committed JDBC Connection
    02:49:47,070 DEBUG JDBCContext:219 - after transaction completion
    02:49:47,080 DEBUG ConnectionManager:404 - aggressively releasing JDBC connection
    02:49:47,080 DEBUG ConnectionManager:441 - releasing JDBC connection [ (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)]
      

  6.   

    你在spring配置文件中,配置事务了没有呀,
    在spring配置文件中定义一下事务,spring就自动会处理了,
    估计你的配置文件中有问题
      

  7.   

    确实是spring的配置文件有点小问题,现在解决了,谢谢各位了!!