GeeCON Prague 2014*
The moose likes Object Relational Mapping and the fly likes Cannot generate a non-primary-key field in hibernate Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Cannot generate a non-primary-key field in hibernate" Watch "Cannot generate a non-primary-key field in hibernate" New topic
Author

Cannot generate a non-primary-key field in hibernate

Renato Bobbio Calogero
Greenhorn

Joined: Apr 20, 2011
Posts: 18
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!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Cannot generate a non-primary-key field in hibernate