Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I get my sequence nextval using QueryDSL?

Tags:

java

querydsl

I was digging around to find a solution to this problem using Oracle and the only thing I was able to find so far was the method nextval from com.mysema.query.sql.SQLExpression, but yet I'm not quite sure how to use it and didn't find anything at all even in the documentation.

Is there someone who had to use it and also have it figured out?

like image 310
Diego Urenia Avatar asked Jul 30 '13 17:07

Diego Urenia


1 Answers

Just call

SQLExpressions.nextval("sequence name")

to get an expression of Long type

If you need another type you call e.g.

SQLExpressions.nextval(Integer.class, "sequence name")
like image 112
Timo Westkämper Avatar answered Nov 02 '22 14:11

Timo Westkämper