Java开发网 Java开发网
注册 | 登录 | 帮助 | 搜索 | 排行榜 | 发帖统计  

您没有登录

» Java开发网 » Java EE 综合讨论区 » Hibernate  

按打印兼容模式打印这个话题 打印话题    把这个话题寄给朋友 寄给朋友    该主题的所有更新都将Email到你的邮箱 订阅主题
flat modethreaded modego to previous topicgo to next topicgo to back
作者 Hibernate Error 請高手指點
Tincle





发贴: 4
积分: 0
于 2007-02-02 10:03 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
我在用 HibernateSync 自動創建的功能,生成的代碼系統老是報錯,
錯誤信息如下:
public static void initialize (String configFileName, Configuration configuration) {
    if (null == configFileName && null != sessionFactory) return;
    else if (null != sessionFactoryMap && null != sessionFactoryMap.get(configFileName)) return;
    else {
      if (null == configFileName) {
        configuration.configure();
        net.echochina.hibernatetest.dao._RootDAO.setSessionFactory(
          configuration.buildSessionFactory());
      }
      else {
        configuration.configure(
          configFileName);
        net.echochina.hibernatetest.dao._RootDAO.setSessionFactory(
          configFileName,
          configuration.buildSessionFactory());
      }
    }
  }

Code line :
configuration.configure();
configuration.buildSessionFactory()
configuration.configure(configFileName);
configuration.buildSessionFactory();
Error Message: Unhandled exception type HibernateException:
總之只要用到configuration,都會報這個錯誤信息.
請高人指點,這是為什麼呢?

(缩略图,点击图片链接看原图)



作者 Re:Hibernate Error 請高手指點 [Re:Tincle]
Tincle





发贴: 4
积分: 0
于 2007-02-02 10:13 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
再補充一下在剛才程序的最前面有這樣一句
import net.sf.hibernate.cfg.Configuration;



作者 Re:Hibernate Error 請高手指點 [Re:Tincle]
JiafanZhou



版主


发贴: 736
积分: 61
于 2007-03-12 20:28 user profilesend a private message to usersend email to JiafanZhousearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
Tincle, some things might be concerned here.

Thanks for your topic, I know that Hibernate Synchronizer plugin removes the need for you to think about updating your Java code when you change your mapping document. It seems a fair way to generate some code.

As far as your question is concerned, can you modify the code using try catch to handle the exception properly? Or are you allowed to modify the code? The error in eclipse told you the Unhandled exception has nothing to do with the imports.

Tincle wrote:
再補充一下在剛才程序的最前面有這樣一句
import net.sf.hibernate.cfg.Configuration;

Hibernate updated to version 3 and changes to *import org.hibernate.cfg.Configuration;* package now.

BTW, according to the Java naming convention, I hate any class name begins with an underscore, and DAO shall be refactored to Dao. If those classes are auto-generated ones, then shame on the Hibernate Synchronizer coders.

Regards,
Jiafan



When I was a kid I used to pray every night for a new bike. Then I realized that The Lord doesn't work that way, so I stole one and asked him to forgive me.
作者 Re:Hibernate Error 請高手指點 [Re:Tincle]
fuvicky





发贴: 3
积分: 0
于 2007-03-13 10:00 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
算是解决了吧??

------------------------------
智博数码域名注册虚拟主机



作者 Re:Hibernate Error 請高手指點 [Re:Tincle]
xuxiong2





发贴: 4
积分: 0
于 2007-03-13 16:07 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
无论你是高手还是刚开始学编程的

现在去米鼠望注册会员

可以答题拿积分 米鼠积分是1积分等价于1RMB的

赶快行动吧

网址:www.***




flat modethreaded modego to previous topicgo to next topicgo to back
  已读帖子
  新的帖子
  被删除的帖子
Jump to the top of page

   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923