#generate DB record id in the DB and not in java

9 messages · Page 1 of 1 (latest)

lean fox
#

hey guys. i have pojo that is being inserted into my DB. i dont want to have id field in my pojo and let my DB generate record id. can i do it somehow? thanks

frozen grottoBOT
#

This post has been reserved for your question.

Hey @lean fox! Please use /close or the Close Post button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.

TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.

rough kiln
#

Is your Pojo an Entity?

#

What is your database vendor? Postgres, Oracle, Mysql?

ornate rampart
#

My questions would be what counts as the DB and what counts as Java.
As far as the DB is concerned, objects don't exist. you call INSERT statements to it. That's it.
Admittedly some while allow to create columns where an id is automatically created when inserting a row in their table, but that doesn't sound much like what's asked.

rough kiln
ornate rampart
rough kiln