Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Entity Update throws NPE for @ElementColection of Map - Eclipselink 2.5.2
Entity Update throws NPE for @ElementColection of Map - Eclipselink 2.5.2 [message #1706765] Sun, 30 August 2015 18:54 Go to next message
Ashok Shan is currently offline Ashok ShanFriend
Messages: 4
Registered: August 2015
Junior Member
I have Department and Employee Entities. Employee table has three columns: DEPARTMENT_ID, KEY, VALUE. Inserted the null value in my insert for non null key in the Employee table. I received NullPOinterException during my update with non null value for exisiting key during prop.put(key, value);

java.lang.NullPointerException
at java.util.Hashtable.put(Hashtable.java:514)
at org.eclipse.persistence.indirection.IndirectMap.put(IndirectMap.java:543)
at org.eclipse.persistence.internal.queries.MapContainerPolicy.addInto(MapContainerPolicy.java:131)
at org.eclipse.persistence.internal.queries.MappedKeyMapContainerPolicy.addInto(MappedKeyMapContainerPolicy.java:196)
at org.eclipse.persistence.queries.DataReadQuery.executeNonCursor(DataReadQuery.java:226)
at org.eclipse.persistence.queries.DataReadQuery.executeDatabaseQuery(DataReadQuery.java:152)
at org.eclipse.persistence.queries.DatabaseQuery.execute(DatabaseQuery.java:899)
at org.eclipse.persistence.queries.DataReadQuery.execute(DataReadQuery.java:137)
at org.eclipse.persistence.queries.DatabaseQuery.executeInUnitOfWork(DatabaseQuery.java:798)
at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.internalExecuteQuery(UnitOfWorkImpl.java:2896)
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1804)
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1786)
at org.eclipse.persistence.internal.indirection.QueryBasedValueHolder.instantiate(QueryBasedValueHolder.java:129)
at org.eclipse.persistence.internal.indirection.QueryBasedValueHolder.instantiate(QueryBasedValueHolder.java:116)
at org.eclipse.persistence.internal.indirection.DatabaseValueHolder.getValue(DatabaseValueHolder.java:89)
at org.eclipse.persistence.internal.indirection.UnitOfWorkValueHolder.instantiateImpl(UnitOfWorkValueHolder.java:173)
at org.eclipse.persistence.internal.indirection.UnitOfWorkValueHolder.instantiate(UnitOfWorkValueHolder.java:234)
at org.eclipse.persistence.internal.indirection.DatabaseValueHolder.getValue(DatabaseValueHolder.java:89)
at org.eclipse.persistence.indirection.IndirectMap.buildDelegate(IndirectMap.java:109)
at org.eclipse.persistence.indirection.IndirectMap.getDelegate(IndirectMap.java:329)
at org.eclipse.persistence.indirection.IndirectMap.put(IndirectMap.java:543)



EclipseLink version is 2.5.2

I have Department and Employee Entities and Department Entity class has the following relationship with Employee Entity.

@Entity
@Table(name = "DEPARTMENT" uniqueConstraints = {
@UniqueConstraint(columnNames = { "NAME" }) })
@NamedQueries( {
@NamedQuery(name = Department.findAll", query = "select d from Department d"),
@NamedQuery(name = Department.findByName", query = "select d from Department d WHERE d.name = :name")})

public class Department implements Serializable {

@ElementCollection
@MapKeyColumn( name = "KEY")
@Column( name = "VALUE")
@CollectionTable(name="DEPARTMENT_PROP", joinColumns = @joinColumn(name= "DEPARTMENT_ID))
private final Map<String, String> props = new HashMap();


public Map<String, String> getProperties() {
return properties;
}

Re: Entity Update throws NPE for @ElementColection of Map - Eclipselink 2.5.2 [message #1707420 is a reply to message #1706765] Fri, 04 September 2015 15:24 Go to previous message
Chris Delahunt is currently offline Chris DelahuntFriend
Messages: 1380
Registered: July 2009
Senior Member
EclipseLink uses hashTables and does not allow for null keys or values.
Previous Topic:Hung threads
Next Topic:Getting a naming exception for a DataSource that I can find programatically
Goto Forum:
  


Current Time: Sun Mar 07 04:56:23 GMT 2021

Powered by FUDForum. Page generated in 0.01780 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top