aspose file tools*
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Table per class Support in JPA Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "Table per class Support in JPA" Watch "Table per class Support in JPA" New topic
Author

Table per class Support in JPA

Amandeep Singh
Ranch Hand

Joined: Jul 17, 2008
Posts: 844
Well i am trying the table per class strategy....

i do implement in my classes like this-

Car.java
------------
@Entity
@Table(name="Car")
//@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
//@Inheritance(strategy = InheritanceType.JOINED)
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
@DiscriminatorColumn(name="car_type", discriminatorType=DiscriminatorType.STRING, length=1)
public class Car implements Serializable{
--------------


CarBillingInfo.java
--------------------------
@Entity
@Table(name="CarBillingInfo")
@DiscriminatorValue(value="B")
//@PrimaryKeyJoinColumn(name="id")
public class CarBillingInfo extends Car implements Serializable {
--------------------------------

CarSellingInfo.java
--------------------------------
@Entity
@Table(name="CarSellingInfo")
@DiscriminatorValue(value="S")
//@PrimaryKeyJoinColumn(name="id")
public class CarSellingInfo extends Car implements Serializable {
----------------------------------

but when i deploy this jar file to Glassfish. i do get following exception's in server.log

---------------------------------
[#|2008-11-24T22:54:21.984-0500|SEVERE|sun-appserver-pe9.0|javax.enterprise.system.tools.deployment|_ThreadID=12;_ThreadName=Timer-2;_RequestID=6fb25190-b619-4490-9e84-2895bfcbe10e;|Exception occured in J2EEC Phase
com.sun.enterprise.deployment.backend.IASDeploymentException: Deployment Error --
Exception Description: Table per class inheritance is not supported. Entity class [class Pack.Car].
at oracle.toplink.essentials.exceptions.ValidationException.tablePerClassInheritanceNotSupported(ValidationException.java:1399)
at oracle.toplink.essentials.internal.ejb.cmp3.metadata.MetadataDescriptor.setInheritanceStrategy(MetadataDescriptor.java:781)
at oracle.toplink.essentials.internal.ejb.cmp3.metadata.accessors.ClassAccessor.processInheritanceRoot(ClassAccessor.java:925)
at oracle.toplink.essentials.internal.ejb.cmp3.metadata.accessors.ClassAccessor.processTableAndInheritance(ClassAccessor.java:1360)
at oracle.toplink.essentials.internal.ejb.cmp3.metadata.accessors.ClassAccessor.process(ClassAccessor.java:454)
at oracle.toplink.essentials.internal.ejb.cmp3.metadata.MetadataProcessor.processAnnotations(MetadataProcessor.java:196)
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.ModuleDeployer.handlePostDeployEvent(ModuleDeployer.java:689)
at com.sun.enterprise.deployment.backend.ModuleDeployer.postDeploy(ModuleDeployer.java:677)
at com.sun.enterprise.deployment.backend.ModuleDeployer.doRequestFinish(ModuleDeployer.java:169)
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:263)
at com.sun.enterprise.deployment.phasing.PEDeploymentService.deploy(PEDeploymentService.java:281)
at com.sun.enterprise.admin.mbeans.ApplicationsConfigMBean.deploy(ApplicationsConfigMBean.java:534)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.sun.enterprise.admin.MBeanHelper.invokeOperationInBean(MBeanHelper.java:353)
at com.sun.enterprise.admin.MBeanHelper.invokeOperationInBean(MBeanHelper.java:336)
at com.sun.enterprise.admin.config.BaseConfigMBean.invoke(BaseConfigMBean.java:448)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:836)
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:761)
at sun.reflect.GeneratedMethodAccessor15.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.sun.enterprise.admin.util.proxy.ProxyClass.invoke(ProxyClass.java:77)
at $Proxy1.invoke(Unknown Source)
at com.sun.enterprise.admin.server.core.jmx.SunoneInterceptor.invoke(SunoneInterceptor.java:297)
at com.sun.enterprise.deployment.autodeploy.AutoDeployer.invokeDeploymentService(AutoDeployer.java:413)
at com.sun.enterprise.deployment.autodeploy.AutoDeployer.deploy(AutoDeployer.java:394)
at com.sun.enterprise.deployment.autodeploy.AutoDeployer.deployAll(AutoDeployer.java:253)
at com.sun.enterprise.deployment.autodeploy.AutoDeployControllerImpl$AutoDeployTask.run(AutoDeployControllerImpl.java:358)
at java.util.TimerThread.mainLoop(Timer.java:512)
at java.util.TimerThread.run(Timer.java:462)
|#]

[#|2008-11-24T22:54:21.984-0500|SEVERE|sun-appserver-pe9.0|javax.enterprise.system.tools.deployment|_ThreadID=12;_ThreadName=Timer-2;Deployment Error --
Exception Description: Table per class inheritance is not supported. Entity class [class Pack.Car].
;_RequestID=6fb25190-b619-4490-9e84-2895bfcbe10e;|"DPL8011: autodeployment failure while deploying the application : Deployment Error --
Exception Description: Table per class inheritance is not supported. Entity class [class Pack.Car].
"|#]

[#|2008-11-24T22:54:21.984-0500|INFO|sun-appserver-pe9.0|javax.enterprise.system.tools.deployment|_ThreadID=12;_ThreadName=Timer-2;|[AutoDeploy] Autodeploy failed : C:\Sun\SDK\domains\domain1\autodeploy\JarFile.jar.|#]

----------------------------------------------------

Does that mean Table per class strategy in not supported in EJB3 JPA?


SCJP 1.4, SCWCD 5, SCBCD 5, OCPJWSD 5,SCEA-1, Started Assignment Part 2
My blog- http://rkydesigns.blogspot.com
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

The support for this strategy is optional, and Glassfish does not support it.


[My Blog]
All roads lead to JavaRanch
Amandeep Singh
Ranch Hand

Joined: Jul 17, 2008
Posts: 844
The support for this strategy is optional, and Glassfish does not support it.


Do you think the EJB3 JPA, is more of a kind related to Oracle TopLink, so it is not supported by Oracle TopLink,
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Table per class Support in JPA