dual is not mapped,select ordercode_seq_id.nextval nextvalue from dual
2013-02-19 11:57
387 查看
项目中,用到一个序列作单号,框架用的是ssh,在dao层去拿的时候,运行时报错为dual is not mapped,[select ordercode_seq_id.nextval nextvalue from dual]
后来检查发现,获取方式不对,于是改成下面这样,就可以正常获取了
Java代码
public String getOrderCode() {
try {
String sql = "select ordercode_seq_id.nextval nextvalue from dual";
Integer maxId = (Integer)(this.getSession().createSQLQuery(sql).addScalar("nextvalue", Hibernate.INTEGER) ).uniqueResult();
return maxId.toString();
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
后来检查发现,获取方式不对,于是改成下面这样,就可以正常获取了
Java代码
public String getOrderCode() {
try {
String sql = "select ordercode_seq_id.nextval nextvalue from dual";
Integer maxId = (Integer)(this.getSession().createSQLQuery(sql).addScalar("nextvalue", Hibernate.INTEGER) ).uniqueResult();
return maxId.toString();
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
相关文章推荐
- dual is not mapped,select ordercode_seq_id.nextval nextvalue from dual
- g.hibernate.hql.ast.QuerySyntaxException: tbl_base_count is not mapped [SELECT COUNT(*) FROM tbl_bas
- QuerySyntaxException: Professional is not mapped [select professional FROM Professional]
- tb_cat is not mapped [ select c from tb_cat c ]
- [SSH]HQL语句错误QuerySyntaxException: Student is not mapped [from Student stu order by stu.userna
- SSH报错:org.hibernate.hql.ast.QuerySyntaxException: User is not mapped [select o from User o where 1=1
- Mapped Statements collection does not contain value forQuestion.selectParam
- select * from (select P.*,ROWNUM RN FROM(select * from Mp_Relatedart where pubbaseid=785 order by ID ASC )P)M WHERE M.RN>2 and M.RN <= 7
- TbCustConsuServuser is not mapped [From TbCustConsuServuser cust]
- org.hibernate.hql.ast.QuerySyntaxException per is not mapped [from Per as p]
- Hibernate中运行程序时报错:org.hibernate.hql.internal.ast.QuerySyntaxException: apibasic is not mapped [from
- is not mapped [from
- nested exception is org.hibernate.exception.SQLGrammarException: could not get next sequence value
- Mapped Statements collection does not contain value for TaskMapper.selectByPrimaryKey
- Bugzilla 4.1 版delete product时提示“visibility_value_id is not a valid parameter for the Bugzilla::Field::match”
- The breakpoint will not currently be hit. The source code is different from the original version
- Hibernate出现错误:stock is not mapped from stock
- org.hibernate.hql.internal.ast.QuerySyntaxException: userinfo is not mapped [from userinfo u where u
- Solution to "The breakpoint will not currently be hit. The source code is different from the original version."
- Exit code from container executor initialization is : 24 ExitCodeException exitCode=24: Configuration file ../etc/hadoop/container-executor.cfg not found.