Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community Forumsplease help, errors with Map <Entity, Basic>
https://www.eclipse.org/forums/index.php/mv/msg/359250/882327/#msg_882327
In my bean I have attribute as:
private Map <Skill, Date> skills;
I am using orm.xml instead of annotations and have this chunk of configuration:
create table EMPLOYEE (
ID_EMPLOYEE numeric (12) not null,
DESCRIPTION varchar(500) null
);
alter table EMPLOYEE add primary key (ID_EMPLOYEE);
create table SKILL (
ID_SKILL numeric (12) not null,
DESCRIPTION varchar(500) null
);
alter table SKILL add primary key (ID_SKILL);
create table ACQUIRED_SKILL (
ID_SKILL numeric (12) not null,
ID_EMPLOYEE numeric (12) not null,
ACQUIRED_ON date null
);
alter table ACQUIRED_SKILL add primary key (ID_SKILL,ID_EMPLOYEE);
alter table ACQUIRED_SKILL add foreign key (ID_SKILL) references SKILL (ID_SKILL);
alter table ACQUIRED_SKILL add foreign key (ID_EMPLOYEE) references EMPLOYEE (ID_EMPLOYEE);
when I put a 'transient' on the attribute of my bean everything apart of this mapping works, probably because it's ignored, otherwise i get exceptions:
[EL Config]: metadata: 2012-06-06 10:39:24.821--ServerSession(8906500)--Thread(Thread[main,5,main])--The primary key column name for the mapping element [field skills] is being defaulted to: ID_EMPLOYEE.
[EL Config]: metadata: 2012-06-06 10:39:24.821--ServerSession(8906500)--Thread(Thread[main,5,main])--The primary key column name for the mapping element [field skills] is being defaulted to: ID_SKILL.
Exception [EclipseLink-30005] (Eclipse Persistence Services - 2.4.0.v20120604-r11619): org.eclipse.persistence.exceptions.PersistenceUnitLoadingException
Exception Description: An exception was thrown while searching for persistence archives with ClassLoader: sun.misc.Launcher$AppClassLoader@35ce36
Internal Exception: javax.persistence.PersistenceException: Exception [EclipseLink-28018] (Eclipse Persistence Services - 2.4.0.v20120604-r11619): org.eclipse.persistence.exceptions.EntityManagerSetupException
Exception Description: Predeployment of PersistenceUnit [sara-beans] failed.
Internal Exception: java.lang.NullPointerException
P.S. eclipse 3.7sr2, java 1.6.0.31
Thanks]]>Luisa Rossi2012-06-06T09:04:06-00:00Re: please help, errors with Map <Entity, Basic>
https://www.eclipse.org/forums/index.php/mv/msg/359250/882466/#msg_882466
Best Regards,
Chris]]>Chris Delahunt2012-06-06T14:05:09-00:00Re: please help, errors with Map <Entity, Basic>
https://www.eclipse.org/forums/index.php/mv/msg/359250/882511/#msg_882511
java.sql.Date without temporal gave the same exceptions, regarding the annotations I have to use the xml, but I briefly tried with those and it gave me the same result... If you want I can extract this in smallish maven project...]]>Luisa Rossi2012-06-06T15:55:50-00:00Re: please help, errors with Map <Entity, Basic>
https://www.eclipse.org/forums/index.php/mv/msg/359250/882992/#msg_882992
@ElementCollection
@CollectionTable(name = "ADV_SIMPLE_ENTITY_LANGUAGE", joinColumns = @JoinColumn(name = "SIMPLE_ID"))
@MapKeyJoinColumn(name = "LANG_CODE", referencedColumnName = "CODE")
@Column(name = "LANG_DESCRIPTION")
private Map<SimpleLanguage, String> simpleLanguage
So I'm not sure what is different from yours other than using a Date instead of String. Can you please post the exception for now, as I may be able to tell what might be going wrong if it can show what might be null in the code.
Regards,
Chris]]>Chris Delahunt2012-06-07T15:48:44-00:00Re: please help, errors with Map <Entity, Basic>
https://www.eclipse.org/forums/index.php/mv/msg/359250/883294/#msg_883294
Maybe it's nothing but I am using a .xml instead of annotations anyway here is my stacktrace, hope it helps:
Exception in thread "main" Local Exception Stack:
Exception [EclipseLink-30005] (Eclipse Persistence Services - 2.4.0.v20120604-r11619): org.eclipse.persistence.exceptions.PersistenceUnitLoadingException
Exception Description: An exception was thrown while searching for persistence archives with ClassLoader: sun.misc.Launcher$AppClassLoader@35ce36
Internal Exception: javax.persistence.PersistenceException: Exception [EclipseLink-28018] (Eclipse Persistence Services - 2.4.0.v20120604-r11619): org.eclipse.persistence.exceptions.EntityManagerSetupException
Exception Description: Predeployment of PersistenceUnit [ski] failed.
Internal Exception: java.lang.NullPointerException
at org.eclipse.persistence.exceptions.PersistenceUnitLoadingException.exceptionSearchingForPersistenceResources(PersistenceUnitLoadingException.java:127)
at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactory(PersistenceProvider.java:115)
at javax.persistence.Persistence.createEntityManagerFactory(Unknown Source)
at it.esempio.jpa.JPAStarter.main(JPAStarter.java:61)
Caused by: javax.persistence.PersistenceException: Exception [EclipseLink-28018] (Eclipse Persistence Services - 2.4.0.v20120604-r11619): org.eclipse.persistence.exceptions.EntityManagerSetupException
Exception Description: Predeployment of PersistenceUnit [ski] failed.
Internal Exception: java.lang.NullPointerException
at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.createPredeployFailedPersistenceException(EntityManagerSetupImpl.java:1541)
at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.predeploy(EntityManagerSetupImpl.java:1532)
at org.eclipse.persistence.internal.jpa.deployment.JPAInitializer.callPredeploy(JPAInitializer.java:98)
at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactory(PersistenceProvider.java:105)
... 2 more
Caused by: Exception [EclipseLink-28018] (Eclipse Persistence Services - 2.4.0.v20120604-r11619): org.eclipse.persistence.exceptions.EntityManagerSetupException
Exception Description: Predeployment of PersistenceUnit [ski] failed.
Internal Exception: java.lang.NullPointerException
at org.eclipse.persistence.exceptions.EntityManagerSetupException.predeployFailed(EntityManagerSetupException.java:221)
... 6 more
Caused by: java.lang.NullPointerException
at org.eclipse.persistence.internal.jpa.metadata.ORMetadata.setFieldName(ORMetadata.java:715)
at org.eclipse.persistence.internal.jpa.metadata.columns.MetadataColumn.getDatabaseField(MetadataColumn.java:109)
at org.eclipse.persistence.internal.jpa.metadata.columns.RelationalColumnMetadata.getForeignKeyField(RelationalColumnMetadata.java:86)
at org.eclipse.persistence.internal.jpa.metadata.columns.JoinColumnMetadata.getForeignKeyField(JoinColumnMetadata.java:118)
at org.eclipse.persistence.internal.jpa.metadata.columns.RelationalColumnMetadata.getForeignKeyField(RelationalColumnMetadata.java:97)
at org.eclipse.persistence.internal.jpa.metadata.accessors.mappings.MappingAccessor.processForeignKeyRelationship(MappingAccessor.java:1696)
at org.eclipse.persistence.internal.jpa.metadata.accessors.mappings.MappingAccessor.processEntityMapKeyClass(MappingAccessor.java:1536)
at org.eclipse.persistence.internal.jpa.metadata.accessors.mappings.MappingAccessor.processMapKeyClass(MappingAccessor.java:1608)
at org.eclipse.persistence.internal.jpa.metadata.accessors.mappings.MappingAccessor.processContainerPolicyAndIndirection(MappingAccessor.java:1419)
at org.eclipse.persistence.internal.jpa.metadata.accessors.mappings.DirectCollectionAccessor.processDirectMapMapping(DirectCollectionAccessor.java:472)
at org.eclipse.persistence.internal.jpa.metadata.accessors.mappings.ElementCollectionAccessor.process(ElementCollectionAccessor.java:774)
at org.eclipse.persistence.internal.jpa.metadata.MetadataProject.processDirectCollectionAccessors(MetadataProject.java:1445)
at org.eclipse.persistence.internal.jpa.metadata.MetadataProject.processStage3(MetadataProject.java:1718)
at org.eclipse.persistence.internal.jpa.metadata.MetadataProcessor.processORMMetadata(MetadataProcessor.java:535)
at org.eclipse.persistence.internal.jpa.deployment.PersistenceUnitProcessor.processORMetadata(PersistenceUnitProcessor.java:550)
at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.predeploy(EntityManagerSetupImpl.java:1469)
... 4 more
]]>Luisa Rossi2012-06-08T08:21:41-00:00Re: please help, errors with Map <Entity, Basic>
https://www.eclipse.org/forums/index.php/mv/msg/359250/883564/#msg_883564
Try changing it to
<map-key-join-column name="ID_SKILL" referenced-column-name="ID_SKILL"/>
If that resolves the issue please file a bug including the stack stack trace and the example mapping.
Best Regards,
Chris]]>Chris Delahunt2012-06-08T20:02:27-00:00Re: please help, errors with Map <Entity, Basic>
https://www.eclipse.org/forums/index.php/mv/msg/359250/885090/#msg_885090
Unfortunately your 'referenced-column' suggestion doesn't help, error message is the same. In the meantime I prepared a small 'helloworld' project to demo this. If you or somebody else can take a look I would be gratefull.
The culprit is the Employee class more precisely 'skills' attribute, when it is marked as 'transient' it gets ignored and everything works, whan I remove transient: kaboom...
Thanks
]]>Luisa Rossi2012-06-12T12:58:03-00:00Re: please help, errors with Map <Entity, Basic>
https://www.eclipse.org/forums/index.php/mv/msg/359250/888708/#msg_888708
Here you will find further updated alleged example with changes to be decoupled from eclipselink, as in the meantime I tried with other frameowrks (openjpa, hibernate, as you will find them commented-out inside pom.xml)
Please, probably is something trivial, but I am blind...
]]>Luisa Rossi2012-06-18T14:18:52-00:00