I have a j2ee application using hibernate with annotation. How do I annotate the Id field in my pojo class to set it as auto increment or auto generated. and in adding the bean do I leave that field in my bean null?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
and you leave it
null(0) when persisting. (nullif you use theInteger/Longwrappers)In some cases the
AUTOstrategy is resolved toSEQUENCErathen than toIDENTITYorTABLE, so you might want to manually set it toIDENTITYorTABLE(depending on the underlying database).It seems
SEQUENCE+ specifying the sequence name worked for you.