首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

dual is not 地图ped,select ordercode_seq_id.nextval nextvalue from dual

2013-02-24 
dual is not mapped,select ordercode_seq_id.nextval nextvalue from dual项目中,用到一个序列作单号,框

dual is not mapped,select ordercode_seq_id.nextval nextvalue from dual

   项目中,用到一个序列作单号,框架用的是ssh,在dao层去拿的时候,运行时报错为dual is not mapped,[select ordercode_seq_id.nextval nextvalue from dual]

           后来检查发现,获取方式不对,于是改成下面这样,就可以正常获取了

Java代码 
  1. public String getOrderCode() {  
  2.     try {  
  3.         String sql = "select ordercode_seq_id.nextval nextvalue from dual";  
  4.         Integer maxId = (Integer)(this.getSession().createSQLQuery(sql).addScalar("nextvalue", Hibernate.INTEGER) ).uniqueResult();  
  5.         return maxId.toString();  
  6.     } catch (Exception e) {  
  7.         e.printStackTrace();  
  8.     }  
  9.     return null;  
  10. }  

热点排行