wood burning stoves 2.0*
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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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!
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Cannot generate a non-primary-key field in hibernate
 
Similar Threads
Can't not instance class...
If somebody can translate this for me please?
Looking for a database to Java code generator
New to Hibernate: Transaction not getting commited
Cascading non foreign key to Child Table