• 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
  • Piet Souris
  • Frits Walraven
  • Carey Brown

JPA error while using composite primary key : help

Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

i have a table gradeid with primary key is gradeid
i have another table Leave_grade_mapping which has a composite primary key.(id1,id2,gradeif(FK of grade table))

when i run the code i get the following exception

[EL Info]: 2009-11-06 16:46:00.983--ServerSession(5195164)--EclipseLink, version: Eclipse Persistence Services - 1.1.2.v20090612-r4475
[EL Severe]: 2009-11-06 16:46:01.764--ServerSession(5195164)--Local Exception Stack:
Exception [EclipseLink-0] (Eclipse Persistence Services - 1.1.2.v20090612-r4475): org.eclipse.persistence.exceptions.IntegrityException
Descriptor Exceptions:

Exception [EclipseLink-48] (Eclipse Persistence Services - 1.1.2.v20090612-r4475): org.eclipse.persistence.exceptions.DescriptorException
Exception Description: Multiple writable mappings exist for the field [leave_grade_mapping.GRADE]. Only one may be defined as writable, all others must be specified read-only.
Mapping: org.eclipse.persistence.mappings.OneToOneMapping[gradeBean]
Descriptor: RelationalDescriptor(com.myoffice.hr.dao.entities.Leave_grade_mapping --> [DatabaseTable(leave_grade_mapping)])

thank you
Ranch Hand
Posts: 553
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I assume you have a Basic (@Id) and a @OneToOne using the same column. You need to set insertable/updateable=false in one of them.

Consider Paul's rocket mass heater.
    Bookmark Topic Watch Topic
  • New Topic