Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Cannot generate a non-primary-key field in hibernate

 
Renato Bobbio Calogero
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good day every body . I got stuck with hibernate.
I mapped my bean as follows :

Code:


I defined on my Oracle 10G database that my column TASKNUMBER has a default value = 1,
and on my schema I have the field TASKNUMBER as nullable=false. But when I try to insert in my database an object of the type
PCTASK , I got complained that

could not set a field value by reflection setter of previtc.model.task.PcTask.taskNumber

This is obviously because when I instantiate an object PcTask, I do not assign any value to his TASKNUMBER field, because I want
it to be generated at the moment of the Insert statement.

Do you have any ideas on why hibernate is not automatically generate my field when I try to insert my pcTask object ? Thanks a lot!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic