cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John Huss <johnth...@gmail.com>
Subject Re: Accessing a sequence number in java
Date Wed, 23 May 2018 22:04:25 GMT
long myId = ((Number)SQLSelect.dataRowQuery("select nextval('mytable_seq'
as id").selectOne(ec).get("id")).longValue();


On Wed, May 23, 2018 at 3:52 PM Tony Giaccone <tony@giaccone.org> wrote:

> Imagine I have a field in a persistent object, the field is not the primary
> key, and I want it to be unique.  So the obvious choice to me is to use a
> sequence value from the db, so that I can avoid trying to calculate a value
> in java.
>
> Is there an easy way to access that sequence value, from java, using
> Cayenne?
>
>
> Tony
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message