Hi Bart!
You could probably use an INSERT statement with RETURNING clause, which will let you obtain the serial sequence number.

See http://www.postgresql.org/docs/8.2/static/sql-insert.html

Suppose you have an autoincrement column with serial type, you could do it like this:

Statement stgfid = db.createStatement("INSERT INTO forums (type) VALUES('GROUP') RETURNING id");
ResultSet rsgfid = stgfid.executeQuery();
rsgfid.next();
int forumId = rsgfid.getInt(1);
rsgfid.close();
stgfid.close();

Regards,
Vadim