One thing that stands out is, Embeddable class doesn't have persistence
identity so don't use @Table annotation on the embeddable class.
The stacktrace doesn't seem to show the root cause.
A simple example of using @Embeddable and @EmbeddedId (from Java
Persistence spec). Refer to the spec for more details:
@Entity
public class Employee {
@EmbeddedId public EmployeePK getEmpPK() { ... }
...
}
@Embeddable
public class EmployeePK {
String name;
Date bday;
}
-cheng
Eve Pokua wrote:
> Hello everyone,
>
> I have 3 entity classes:
>
> @Entity
> @Table(name="CUSTOMER")
> public class Customerent implements Serializable {
> ........................
>
> .........................}
>
>
> ---------------------------------------------------------------------------------------------------------------
>
>
> @Entity
> @Table(name="ITEMS")
>
> ..................
>
> public class Iteamdetailsent implements Serializable{
> .............................
> .............................
> .............................}
>
>
>
> ---------------------------------------------------------------------------------------------------------------
>
>
> @Entity
> @Table(name="COLLECTPOINTORDERS")
>
> public class CollOrdersrement implements java.io.Serializable{
>
> ......................................................}
>
>
>
>
> ----------------------------------------------------------------------------------------------
>
>
> I am trying to make all these classed into composite keys, so I
> created an embeddable class as follows:
>
> package StockInformation;
> import java.util.Collection;
> import java.util.List;
> import javax.ejb.*;
> import javax.persistence.Column;
> import javax.persistence.Embeddable;
> import javax.persistence.Entity;
> import javax.persistence.Id;
> import javax.persistence.JoinColumn;
> import javax.persistence.ManyToMany;
> import javax.persistence.ManyToOne;
> import javax.persistence.OneToMany;
> import javax.persistence.Table;
>
>
> @Embeddable
> @Table(name="COLLPOINTORDERLINE")
>
> public class CollOrdlinementPK implements java.io.Serializable{
>
>
>
>
> @JoinColumn(name="itmid")
>
> private Iteamdetailsent iteamdetailsent;
>
>
> @JoinColumn(name="cusid")
> @ManyToOne
> private Customerent customerent;
>
> @JoinColumn(name="collOrdID")
> @ManyToOne
> private CollOrdersrement collOrdersrement;
>
>
> }
>
>
>
> I get the following errors:
>
> [#|2007-06-14T10:02:14.312+0100|SEVERE|sun-appserver-pe9.0|javax.enterprise.system.tools.deployment|_ThreadID=16;_ThreadName=Thread-36;_RequestID=14698a97-5f07-4767-89d2-9d7c3a0538b7;|Exception
> occured in J2EEC Phase
> com.sun.enterprise.deployment.backend.IASDeploymentException
> at java.util.AbstractList$Itr.next(AbstractList.java:427)
> at
> oracle.toplink.essentials.internal.ejb.cmp3.metadata.MetadataDescriptor.getPrimaryKeyFieldName(MetadataDescriptor.java:494)
>
> at
> oracle.toplink.essentials.internal.ejb.cmp3.metadata.accessors.ObjectAccessor.processOneToOneForeignKeyRelationship(ObjectAccessor.java:107)
>
> at
> oracle.toplink.essentials.internal.ejb.cmp3.metadata.accessors.ObjectAccessor.processOwningMappingKeys(ObjectAccessor.java:92)
>
> at
> oracle.toplink.essentials.internal.ejb.cmp3.metadata.accessors.ManyToOneAccessor.process(ManyToOneAccessor.java:73)
>
> at
> oracle.toplink.essentials.internal.ejb.cmp3.metadata.accessors.RelationshipAccessor.processRelationship(RelationshipAccessor.java:250)
>
> at
> oracle.toplink.essentials.internal.ejb.cmp3.metadata.MetadataProject.processRelationshipDescriptors(MetadataProject.java:513)
>
> at
> oracle.toplink.essentials.internal.ejb.cmp3.metadata.MetadataProject.process(MetadataProject.java:445)
>
> at
> oracle.toplink.essentials.internal.ejb.cmp3.metadata.MetadataProcessor.processAnnotations(MetadataProcessor.java:203)
>
> at
> oracle.toplink.essentials.internal.ejb.cmp3.EntityManagerSetupImpl.processORMetadata(EntityManagerSetupImpl.java:993)
>
> at
> oracle.toplink.essentials.internal.ejb.cmp3.EntityManagerSetupImpl.predeploy(EntityManagerSetupImpl.java:501)
>
> at
> oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider.createContainerEntityManagerFactory(EntityManagerFactoryProvider.java:152)
>
> at
> com.sun.jdo.spi.persistence.support.ejb.ejbc.PersistenceProcessor.loadPersistenceUnitBundle(PersistenceProcessor.java:467)
>
> at
> com.sun.jdo.spi.persistence.support.ejb.ejbc.PersistenceProcessor.createTablesInDB(PersistenceProcessor.java:325)
>
> at
> com.sun.jdo.spi.persistence.support.ejb.ejbc.PersistenceProcessor.processAppBundle(PersistenceProcessor.java:190)
>
> at
> com.sun.jdo.spi.persistence.support.ejb.ejbc.PersistenceProcessor.processApplication(PersistenceProcessor.java:125)
>
> at
> com.sun.jdo.spi.persistence.support.ejb.ejbc.DeploymentEventListenerImpl.processApplication(DeploymentEventListenerImpl.java:193)
>
> at
> com.sun.jdo.spi.persistence.support.ejb.ejbc.DeploymentEventListenerImpl.processEvent(DeploymentEventListenerImpl.java:152)
>
> at
> com.sun.jdo.spi.persistence.support.ejb.ejbc.DeploymentEventListenerImpl.notifyDeploymentEvent(DeploymentEventListenerImpl.java:109)
>
> at
> com.sun.enterprise.deployment.backend.DeploymentEventManager.notifyDeploymentEvent(DeploymentEventManager.java:66)
>
> at
> com.sun.enterprise.deployment.backend.AppDeployer.postDeploy(AppDeployer.java:429)
>
> at
> com.sun.enterprise.deployment.backend.AppDeployer.deploy(AppDeployer.java:225)
>
> at
> com.sun.enterprise.deployment.backend.AppDeployer.doRequestFinish(AppDeployer.java:129)
>
> at
> com.sun.enterprise.deployment.phasing.J2EECPhase.runPhase(J2EECPhase.java:169)
>
> at
> com.sun.enterprise.deployment.phasing.DeploymentPhase.executePhase(DeploymentPhase.java:95)
>
> at
> com.sun.enterprise.deployment.phasing.PEDeploymentService.executePhases(PEDeploymentService.java:871)
>
> at
> com.sun.enterprise.deployment.phasing.PEDeploymentService.deploy(PEDeploymentService.java:266)
>
> at
> com.sun.enterprise.deployment.phasing.PEDeploymentService.deploy(PEDeploymentService.java:739)
>
> at
> com.sun.enterprise.management.deploy.DeployThread.deploy(DeployThread.java:174)
>
> at
> com.sun.enterprise.management.deploy.DeployThread.run(DeployThread.java:210)
>
> |#]
>
>
>
>
> Bearing in mind this is my first time of Embeddable classes, what am I
> doing wrong?
>
> Thanks
>
> eve
>
> _________________________________________________________________
> Play your part in making history - Email Britain!
> http://www.emailbritain.co.uk/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ejb-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: ejb-help_at_glassfish.dev.java.net
>