mmcallis wrote:
Yeah should have gave more info sorry. My cat object has a getId but id in the table is of type sequence, so getId() would return null, as the cat object only has the name variable lets say initialised. Like I said the id is generated in hibernate when saving to the table. The id is never in my code. I need a quick way to get the last record from the table. Thanks for the help, should have made this clearer at the time.
If Hibernate is generating the ID, it will set the value on your object.
If you just want the highest ID #, you can SELECT MAX(ID) FROM YOUR_TABLE.