Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • 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 ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Invalid composite primary key specification(jdeveloper 12c)

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

i am new at ejb. I'am trying to create enitites from tables.

there is two simple tables; department,employees

sql is belove:
---------------------------------------------------------------------------------------

generated classes are below:
--------------------------------------------------------------------------










ERROR i get is:
----------------------------------------------------------------------------------------------------------------
[05:33:35 PM] ---- Deployment started. ----
[05:33:35 PM] Target platform is (Weblogic 12.x).
[05:33:44 PM] Retrieving existing application information
[05:33:45 PM] Running dependency analysis...
[05:33:45 PM] Deploying 2 profiles...
[05:33:45 PM] Wrote Web Application Module to C:\Users\zeki\AppData\Roaming\JDeveloper\system12.1.2.0.40.66.68\o.j2ee\drs\Application73\ViewControllerWebApp.war
[05:33:46 PM] Wrote Enterprise Application Module to C:\Users\zeki\AppData\Roaming\JDeveloper\system12.1.2.0.40.66.68\o.j2ee\drs\Application73
[05:33:50 PM] Deploying Application...
<Jan 2, 2014 5:34:25 PM EET> <Warning> <Application Client> <BEA-2162200> <No Main-Class defined in the manifest file of Java Module: empty.jar. This module will be treated as a utility JAR and subsequent initialization steps will be skipped.>
<Jan 2, 2014 5:35:47 PM EET> <Error> <Deployer> <BEA-149265> <Failure occurred in the execution of deployment request with ID "1388676833872" for task "32". Error is: "weblogic.application.ModuleException: Exception [EclipseLink-7150] (Eclipse Persistence Services - 2.4.2.v20130514-5956486): org.eclipse.persistence.exceptions.ValidationException
Exception Description: Invalid composite primary key specification. The names of the primary key fields or properties in the primary key class [app73.model.EmployeesPK] and those of the entity bean class [class app73.model.Employees] must correspond and their types must be the same. Also, ensure that you have specified ID elements for the corresponding attributes in XML and/or an @Id on the corresponding fields or properties of the entity class."
weblogic.application.ModuleException: Exception [EclipseLink-7150] (Eclipse Persistence Services - 2.4.2.v20130514-5956486): org.eclipse.persistence.exceptions.ValidationException
Exception Description: Invalid composite primary key specification. The names of the primary key fields or properties in the primary key class [app73.model.EmployeesPK] and those of the entity bean class [class app73.model.Employees] must correspond and their types must be the same. Also, ensure that you have specified ID elements for the corresponding attributes in XML and/or an @Id on the corresponding fields or properties of the entity class.
at weblogic.application.internal.ExtensibleModuleWrapper.prepare(ExtensibleModuleWrapper.java:114)
at weblogic.application.internal.flow.ModuleListenerInvoker.prepare(ModuleListenerInvoker.java:100)
at weblogic.application.internal.flow.ModuleStateDriver$1.next(ModuleStateDriver.java:172)
at weblogic.application.internal.flow.ModuleStateDriver$1.next(ModuleStateDriver.java:167)
at weblogic.application.utils.StateMachineDriver$ParallelChange.run(StateMachineDriver.java:80)
Truncated. see log file for complete stacktrace
Caused By: Exception [EclipseLink-7150] (Eclipse Persistence Services - 2.4.2.v20130514-5956486): org.eclipse.persistence.exceptions.ValidationException
Exception Description: Invalid composite primary key specification. The names of the primary key fields or properties in the primary key class [app73.model.EmployeesPK] and those of the entity bean class [class app73.model.Employees] must correspond and their types must be the same. Also, ensure that you have specified ID elements for the corresponding attributes in XML and/or an @Id on the corresponding fields or properties of the entity class.
at org.eclipse.persistence.exceptions.ValidationException.invalidCompositePKSpecification(ValidationException.java:1175)
at org.eclipse.persistence.internal.jpa.metadata.accessors.classes.EntityAccessor.validatePrimaryKey(EntityAccessor.java:1351)
at org.eclipse.persistence.internal.jpa.metadata.accessors.classes.EntityAccessor.processDerivedId(EntityAccessor.java:876)
at org.eclipse.persistence.internal.jpa.metadata.MetadataProject.processAccessorsWithDerivedIDs(MetadataProject.java:1465)
at org.eclipse.persistence.internal.jpa.metadata.MetadataProject.processStage3(MetadataProject.java:1746)
Truncated. see log file for complete stacktrace
>
<Jan 2, 2014 5:35:49 PM EET> <Warning> <Deployer> <BEA-149004> <Failures were detected while initiating deploy task for application "Application73".>
<Jan 2, 2014 5:35:49 PM EET> <Warning> <Deployer> <BEA-149078> <Stack trace for message 149004
weblogic.application.ModuleException: Exception [EclipseLink-7150] (Eclipse Persistence Services - 2.4.2.v20130514-5956486): org.eclipse.persistence.exceptions.ValidationException
Exception Description: Invalid composite primary key specification. The names of the primary key fields or properties in the primary key class [app73.model.EmployeesPK] and those of the entity bean class [class app73.model.Employees] must correspond and their types must be the same. Also, ensure that you have specified ID elements for the corresponding attributes in XML and/or an @Id on the corresponding fields or properties of the entity class.
at weblogic.application.internal.ExtensibleModuleWrapper.prepare(ExtensibleModuleWrapper.java:114)
at weblogic.application.internal.flow.ModuleListenerInvoker.prepare(ModuleListenerInvoker.java:100)
at weblogic.application.internal.flow.ModuleStateDriver$1.next(ModuleStateDriver.java:172)
at weblogic.application.internal.flow.ModuleStateDriver$1.next(ModuleStateDriver.java:167)
at weblogic.application.utils.StateMachineDriver$ParallelChange.run(StateMachineDriver.java:80)
Truncated. see log file for complete stacktrace
Caused By: Exception [EclipseLink-7150] (Eclipse Persistence Services - 2.4.2.v20130514-5956486): org.eclipse.persistence.exceptions.ValidationException
Exception Description: Invalid composite primary key specification. The names of the primary key fields or properties in the primary key class [app73.model.EmployeesPK] and those of the entity bean class [class app73.model.Employees] must correspond and their types must be the same. Also, ensure that you have specified ID elements for the corresponding attributes in XML and/or an @Id on the corresponding fields or properties of the entity class.
at org.eclipse.persistence.exceptions.ValidationException.invalidCompositePKSpecification(ValidationException.java:1175)
at org.eclipse.persistence.internal.jpa.metadata.accessors.classes.EntityAccessor.validatePrimaryKey(EntityAccessor.java:1351)
at org.eclipse.persistence.internal.jpa.metadata.accessors.classes.EntityAccessor.processDerivedId(EntityAccessor.java:876)
at org.eclipse.persistence.internal.jpa.metadata.MetadataProject.processAccessorsWithDerivedIDs(MetadataProject.java:1465)
at org.eclipse.persistence.internal.jpa.metadata.MetadataProject.processStage3(MetadataProject.java:1746)
Truncated. see log file for complete stacktrace
>
[05:35:50 PM] Deployment cancelled.
[05:35:50 PM] ---- Deployment incomplete ----.
[05:35:50 PM] Remote deployment failed (oracle.jdevimpl.deploy.common.Jsr88RemoteDeployer)
#### Cannot run application Application73 due to error deploying to IntegratedWebLogicServer.
[05:35:50 PM] Cancel requested
[Application Application73 stopped and undeployed from IntegratedWebLogicServer]

please help!!
 
author & internet detective
Posts: 40035
809
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Zeki,
Welcome to CodeRanch! I added code tags to make your post easier to read.

The problem is that these types do not match. You'll need to have an Integer type in Employee to match the primary key.

In EmployeePK
public Integer edepartmentId;

In Employee
@Id private Department department;
 
Don't get me started about those stupid light bulbs.
    Bookmark Topic Watch Topic
  • New Topic