• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Persisting Entity with composite key is not working

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I am using Spring3 and hibernate3 and JPA annotations. I have an entity class which has composite key as a primary key. Two columns id and created_time defines primary key. Out of these two columns id is generated using a sequence and created_time is something which we set on entity object.

I have my entity class defined as below with a separate class for primary key.



My DAO has a call to save this entity:



The problem is when I am trying to save this entity using code above, the sequence number generated for the field "id" is totally incorrect. I don't understand why it is doing this. I am new to spring and hibernate. If any can tell me if I am doing something wrong. Let me know if any more information is required.

Any help is greatly appreciated.

Thanks
 
You’ll find me in my office. I’ll probably be drinking. And reading this tiny ad.
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic