Skip to main content

Entity with Map

3 replies [Last post]
ameyec
Offline
Joined: 2005-02-20

I'm using b41

I'm having not problem with maps containing Object values, but only with maps containing String values, the errors I get are:

Exception [TOPLINK-94] (Oracle TopLink Essentials - 2006.3 (Build 060319)): oracle.toplink.essentials.exceptions.DescriptorException
Exception Description: Descriptors must have a table name defined.
Descriptor: RelationalDescriptor(java.lang.String --> [])

Exception [TOPLINK-74] (Oracle TopLink Essentials - 2006.3 (Build 060319)): oracle.toplink.essentials.exceptions.DescriptorException
Exception Description: The primary key fields are not set for this descriptor.
Descriptor: RelationalDescriptor(java.lang.String --> [])

Exception [TOPLINK-108] (Oracle TopLink Essentials - 2006.3 (Build 060319)): oracle.toplink.essentials.exceptions.DescriptorException
Exception Description: Cannot find value in class indicator mapping in parent descriptor [null].
Descriptor: RelationalDescriptor(java.lang.String --> [])

Runtime Exceptions:
---------------------------------------------------------

java.lang.NullPointerException

at oracle.toplink.essentials.internal.sessions.DatabaseSessionImpl.initializeDescriptors(DatabaseSessionImpl.java:428)
at oracle.toplink.essentials.internal.sessions.DatabaseSessionImpl.initializeDescriptors(DatabaseSessionImpl.java:360)
at oracle.toplink.essentials.internal.sessions.DatabaseSessionImpl.postConnectDatasource(DatabaseSessionImpl.java:677)
at oracle.toplink.essentials.internal.sessions.DatabaseSessionImpl.loginAndDetectDatasource(DatabaseSessionImpl.java:559)
at oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider.login(EntityManagerFactoryProvider.java:193)
at oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider.createEntityManagerFactory(EntityManagerFactoryProvider.java:129)
... 18 more

So I need a table name for Strings? That's weird! Any suggestions to solve this ?

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
guypelletier
Offline
Joined: 2005-10-19

This is a bug. You should enter a Glassfish issue to have this resolved. To get around the problem specify a @MapKey on your map.

guypelletier
Offline
Joined: 2005-10-19

Glassfish issue #484 has been entered. https://glassfish.dev.java.net/issues/show_bug.cgi?id=484

ameyec
Offline
Joined: 2005-02-20

I believe this case is simply not supported by the ejb3 spec.
I will have to create a separate entity and map that one to a separate table to implement persistence for this kind of functionality ... (The mapped value will have to be an object of a new class with in Id and the necessary info in it).