I'm writing a JavaEE6 app using NetBeans and persisting the entities on Glassfish
I've got a table of rooms with the Entity Room class to access the data.
The primary key is room_id and I need to find the last value used in order to bump up
the value and then insert a new room record.
So...in order to find the last value used I have a named query which calls the aggregate function MAX
In the session bean I fetch the value this way
Is there a member function of the Query object which returns the value MAX(r.roomId) ??
Something like :