Topic
  • No replies
MN68_Andrew_Stoneberg
1 Post

Pinned topic Persistence Unit does not contain JPA key metadata

‏2013-09-05T20:24:23Z |

I am seeing this error in my logs:

Stack Dump = com.ibm.websphere.objectgrid.plugins.LoaderException: com.ibm.websphere.objectgrid.ObjectGridRuntimeException: The class class xxx.ExchangeSearchOptionJpa in the persistence unit XXX_PU does not contain JPA key metadata.

This entity actually gets its @Id field from the parent of its parent.  Here is the relevant source code of this hierarchy:

 

@Entity
@Table( name = "EXCHANGESEARCHOPTION" )
@AttributeOverrides( {
    @AttributeOverride( name = "addDateTime", column = @Column( name = "ADDDATETIME", nullable = true ) ),
    @AttributeOverride( name = "domainId", column = @Column( name = "DOMAIN_ID", length = 36, nullable = true ) ),
    @AttributeOverride( name = "addPersonId", column = @Column( name = "ADDPERSONID", nullable = true ) ) } )
public class ExchangeSearchOptionJpa extends BaseDomainObjectJpa {

 

 

@MappedSuperclass
public abstract class BaseDomainObjectJpa extends BaseUUIDObjectJpa {

 

@MappedSuperclass
public class BaseUUIDObjectJpa {
    @Id
    @Column( name = "ID", nullable = false, length = 36 )
    protected String id;

 

Now, here is my objectgrid.xml file:

 

 

<objectGrids>
<objectGrid name="XXXUI" txTimeout="30" initialState="PRELOAD">
   
<bean id="TransactionCallback" className="xxx.XXXJPATxCallback">
<property name="persistenceUnitName" type="java.lang.String"
value="XXX_PU" />
</bean>
 
<backingMap name="ExchangeSearchOptions"
pluginCollectionRef="ExchangeSearchOptionsPlugins" writeBehind="T60;C100" nearCacheEnabled="false"/>
                   
<querySchema>
<mapSchemas>
<mapSchema mapName="ExchangeSearchOptions"
valueClass="xxx.ExchangeSearchOptionJpa"
primaryKeyField="id" accessType="FIELD" />
</mapSchemas>
</querySchema>
</objectGrid>
</objectGrids>
 
<backingMapPluginCollections>
<backingMapPluginCollection id="ExchangeSearchOptionsPlugins">
<bean id="Loader" osgiService="exchangeSearchOptionLoader"/>
<bean id="MapIndexPlugin" className="com.ibm.websphere.objectgrid.plugins.index.HashIndex">
<property name="Name" type="java.lang.String" value="DOMAIN_KEY" />
<property name="RangeIndex" type="boolean" value="true" />
<property name="FieldAccessAttribute" type="boolean" value="true" />
<property name="AttributeName" type="java.lang.String"
value="domainId" />
</bean>
<bean id="MapIndexPlugin" className="com.ibm.websphere.objectgrid.plugins.index.HashIndex">
<property name="Name" type="java.lang.String" value="EXCHANGE_KEY" />
<property name="RangeIndex" type="boolean" value="true" />
<property name="FieldAccessAttribute" type="boolean" value="true" />
<property name="AttributeName" type="java.lang.String"
value="exchangeId" />
</bean>
</backingMapPluginCollection>

 

And finally, here is the relevant snippet from my persistence.xml:

 

<persistence-unit name="XXX_PU" transaction-type="RESOURCE_LOCAL">
<provider>com.ibm.websphere.persistence.PersistenceProviderImpl</provider>
<non-jta-data-source>jdbc/XXXUI</non-jta-data-source>
<class>xxx.BaseDomainObjectJpa</class>
<class>xxx.BaseUUIDObjectJpa</class>
<class>xxx.ExchangeSearchOptionJpa</class>

 

This is my first foray into using WXS + JPA (via JPALoader) - but it seems to me like this should be working.  Can anyone point me in the right direction as to what I am doing wrong?  Many thanks.

 

Andy

 

Full Stack Trace:


Exception = com.ibm.websphere.objectgrid.plugins.LoaderException


Source = com.ibm.ws.objectgrid.ObjectGridImpl.activate
probeid = 1090
Stack Dump = com.ibm.websphere.objectgrid.plugins.LoaderException: com.ibm.websphere.objectgrid.ObjectGridRuntimeException: The class class xxx.ExchangeSearchOptionJpa in the persistence unit XXX_PU does not contain JPA key metadata.
        at com.ibm.ws.objectgrid.map.BaseMap.doPreloadMap(BaseMap.java:11415)
        at com.ibm.ws.objectgrid.map.BaseMap.activate(BaseMap.java:11347)
        at com.ibm.ws.objectgrid.ObjectGridImpl.activate(ObjectGridImpl.java:1071)
        at com.ibm.ws.objectgrid.replication.ReplicatedPartition.becomePrimary(ReplicatedPartition.java:1192)
        at com.ibm.ws.objectgrid.replication.ReplicatedPartition.processPrimaryWork(ReplicatedPartition.java:602)
        at com.ibm.ws.objectgrid.replication.ReplicatedPartition.handleMigrationEvent(ReplicatedPartition.java:512)
        at com.ibm.ws.objectgrid.server.impl.ShardImpl.handleRoleTransition(ShardImpl.java:313)
        at com.ibm.ws.objectgrid.server.impl.ShardActor.handleRoleTransition(ShardActor.java:975)
        at com.ibm.ws.objectgrid.server.container.ObjectGridContainerImpl.doContainerWork(ObjectGridContainerImpl.java:828)
        at com.ibm.ws.objectgrid.server.container.ContainerActor$2.run(ContainerActor.java:302)
        at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1723)
Caused by: com.ibm.websphere.objectgrid.ObjectGridRuntimeException: The class class xxx.ExchangeSearchOptionJpa in the persistence unit XXX_PU does not contain JPA key metadata.
        at com.ibm.ws.objectgrid.jpa.JPAHelper.getJPAMetadata(JPAHelper.java:75)
        at xxx.XXXPALoader.initialize(MEGJPALoader.java:284)
        at xxx.XXXJPALoader.preloadMap(MEGJPALoader.java:559)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:88)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
        at java.lang.reflect.Method.invoke(Method.java:613)
        at com.ibm.ws.xs.osgi.service.XSServiceHandler.invoke(XSServiceHandler.java:87)
        at com.ibm.ws.xs.osgi.service.BackingMapServiceHandler.invoke(BackingMapServiceHandler.java:74)
        at com.sun.proxy.$Proxy74.preloadMap(Unknown Source)
        at com.ibm.ws.objectgrid.writebehind.WriteBehindLoader.preloadMap(WriteBehindLoader.java:288)
        at com.ibm.ws.objectgrid.map.BaseMap.doPreloadMap(BaseMap.java:11406)
        ... 10 more