Entity Update throws NPE for @ElementColection of Map - Eclipselink 2.5.2 [message #1706765] |
Sun, 30 August 2015 18:54 |
Ashok Shan 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;
}
|
|
|
|
Powered by
FUDForum. Page generated in 0.05897 seconds