Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » [RESOLVED] How to Query "nextval('sequence_name');" in EclipseLink(how to, better way to)
[RESOLVED] How to Query "nextval('sequence_name');" in EclipseLink [message #1021259] Tue, 19 March 2013 18:51 Go to next message
Dante Basso is currently offline Dante Basso
Messages: 5
Registered: March 2013
Junior Member
Hello all,

Well I'm new here and newbie with EclipseLink ,byt I would like to know, how to make get value from this query:

"SELECT nextval('sequence_name');"


I need to use the sequence generated by database on the webapp. This value will not be used on the database to persist anything, it's just a way to generate am unique value to a method execution/process...

It's possible to make something like this?
I read a litle about the EclipseLink and see some Screencasts but I couldn't understand how to make this query works.

Thanks all.

[Updated on: Wed, 20 March 2013 12:58]

Report message to a moderator

Re: How to Query "nextval('sequence_name');" in EclipseLink [message #1021641 is a reply to message #1021259] Wed, 20 March 2013 12:58 Go to previous messageGo to next message
Dante Basso is currently offline Dante Basso
Messages: 5
Registered: March 2013
Junior Member
Well I make this works in The J2SE, but not in j2EE.
Re: How to Query "nextval('sequence_name');" in EclipseLink [message #1027042 is a reply to message #1021641] Tue, 26 March 2013 13:56 Go to previous message
James Sutherland is currently offline James Sutherland
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

You can use a native SQL query.

em.createNativeQuery("SELECT MYSEQUENCE.NEXTVAL FROM DUAL").getSingleResult();


James : Wiki : Book : Blog : Twitter
Previous Topic:how to store a page of text as string in JPA 2.0
Next Topic:Infinite loop with self-referencing bi-directional relationship
Goto Forum:
  


Current Time: Thu Sep 18 22:00:24 GMT 2014

Powered by FUDForum. Page generated in 0.01625 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software