ejb@glassfish.java.net

_at_Embeddable class

From: Eve Pokua <gorgeous65_at_msn.com>
Date: Thu, 14 Jun 2007 16:03:51 +0100

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/