| From: | "G(dot)L(dot) Grobe" <gary(at)grobe(dot)net> |
|---|---|
| To: | <pgsql-general(at)postgresql(dot)org> |
| Subject: | getting nextval from query? |
| Date: | 2001-07-29 05:56:18 |
| Message-ID: | 004501c117f3$2fb7f000$0200a8c0@trinity |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
To create a primary key for one of my session beans within the ejbCreate(), I'm doing a the following.
...
query = "SELECT NEXTVAL('versions_seq')";
pstmt = dbConn.prepareStatement(query);
rs = pstmt.executeQuery();
rs.next();
num = (int) rs.getInt("last_value");
But as show by the exception below, this does not work. How do I get the nextval value out from this query? So it's an attribute ... but I'd still like to know how to get to it.
[Default] Exception = The column name last_value not found.
[BuildKit] TRANSACTION ROLLBACK EXCEPTION:null; nested exception is:
javax.ejb.EJBException
Any help much appreciated.
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Dave Cramer | 2001-07-29 12:02:23 | RE: getting nextval from query? |
| Previous Message | Ben Udkow | 2001-07-29 00:54:15 | How do I set datestyle to postgres at initialization? |