Java(TM) Platform SE binary 一运行就停止了,是什么情况?求大神帮忙

u010385853 2013-09-24 09:21:57
...全文
2476 7 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
u010385853 2013-09-24
  • 打赏
  • 举报
回复
package com.insigma.luyongjie; import java.util.List; import org.hibernate.Query; import org.hibernate.Session; import com.insigma.pojo.Account; import com.insigma.pojo.HibernateSessionFactory; public class AccountDAO4Hibernate { public Account QueryAccountById(Integer id){ Session session = HibernateSessionFactory.getSession(); Account account = (Account)session.get(Account.class, id); HibernateSessionFactory.closeSession(); return account; } public Account QueryAccount(Integer id){ Session session = HibernateSessionFactory.getSession(); // String HQL="form Account where id:acid"; String HQL="form Account where id="+id; Query query = session.createQuery(HQL); query.setInteger("acid", id); Account account = (Account)query.uniqueResult(); HibernateSessionFactory.closeSession(); return account; } public List<Account> QueryAllAccount(){ Session session = HibernateSessionFactory.getSession(); // String HQL="form Account where id:acid"; String HQL="form Account "; Query query = session.createQuery(HQL); List<Account> list = query.list(); HibernateSessionFactory.closeSession(); return list; } public static void main(String[] args) { // Account account = new AccountDAO4Hibernate().QueryAccountById(2); // System.out.println(account.getName()); List<Account> list = new AccountDAO4Hibernate().QueryAllAccount(); for (Account account : list) { System.out.println(account.getName()); } } } 帮忙看看 是程序的什么问题吗?
  • 打赏
  • 举报
回复
运行啥程序?
u010385853 2013-09-24
  • 打赏
  • 举报
回复
就是用 自己装的,jdk1.7 以前还好,昨天就出现这个问题了,是不是与运行的程序有关啊?
  • 打赏
  • 举报
回复
myeclipse里改为自己安装的jdk,别用自带的了。
u010385853 2013-09-24
  • 打赏
  • 举报
回复
jdk 和机器 都是64位的啊,而且运行 java 有反应,就是在myeclipse 运行程序 就出错了
  • 打赏
  • 举报
回复
命令行运行java有反应吗? 装的jdk版本是否和机器匹配?
  • 打赏
  • 举报
回复
重装下试试

51,397

社区成员

发帖
与我相关
我的任务
社区描述
Java相关技术讨论
javaspring bootspring cloud 技术论坛(原bbs)
社区管理员
  • Java相关社区
  • 小虚竹
  • 谙忆
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧