Topics

Internal Exception: java.sql.SQLException: ORA-01400: kan ikke sette inn NULL i ("XXXUSER"."ABSTRACT_FIELD_VALUE_PART_TABLE"."ID")


Trond Arild Lode Tobiassen Heidelberg
 
Edited

The below happens when a number of table-rows have been inserted successfully in other tables, using the exact same setup.

Note that the sequence is reported to not being deleted during startup (of glassfish embedded). I wonder if this means that GenerationType.SEQUENCE is not in effect and necessary table/sequence is not even generated - resulting in primary key auto generation is somewhat lacking. Allthough I can find the sequence:

CREATED 23.11.2017
LAST_DDL_TIME 23.11.2017
SEQUENCE_OWNER REGUSER
SEQUENCE_NAME SEQ_GEN_SEQUENCE
MIN_VALUE 1
MAX_VALUE 9999999999999999999999999999
INCREMENT_BY 50
CYCLE_FLAG N
ORDER_FLAG N
CACHE_SIZE 20
LAST_NUMBER 1050
SCALE_FLAG N
EXTEND_FLAG N
SESSION_FLAG N
KEEP_VALUE N

in the database.

I notice that the cache size is 20, the increment is 50 and the usage stops at 1050, when the cache is emptied (50*20 +50). Might this cache size be the problem?

@Entity(name = "ABSTRACT_FIELD_VALUE_PART_TABLE")
@DiscriminatorColumn(length=64)
public abstract class AbstractFieldValuePart<T extends AbstractFieldValuePart<T>> implements IIsValid, Serializable {
@Id
@GeneratedValue(strategy=GenerationType.SEQUENCE)
private Long id;
 
public Long getId() {
return id;
}
 
private void setId(Long id) {
this.id = id;
}


@Entity(name="PROTOCOL_VERSION_TABLE")
public final class ProtocolVersion extends AbstractFieldValuePart<ProtocolVersion> {
/**
*/
private static final long serialVersionUID = 41530596431029952L;
 
public ProtocolVersion(ProtocolVersion inp) {
super(inp);
if (inp.sipScheme != null)
this.sipScheme = inp.sipScheme;
else
this.schemeToken = inp.schemeToken;
this.version = inp.version;
}
 
protected ProtocolVersion() {
}
 
@Column(name = "PROTOCOL_VERSION_SIP_SCHEME", unique = false, nullable = true, updatable = false)
private UriScheme sipScheme;
 
public UriScheme getSipScheme() {
return sipScheme;
}
 
private void setSipScheme(UriScheme sipScheme) {
this.sipScheme = sipScheme;
}
 
@Column(name = "PROTOCOL_VERSION_SCHEME_TOKEN", unique = false, nullable = true, updatable = false)
private String schemeToken;
 
public String getSchemeToken() {
return schemeToken;
}
 
private void setSchemeToken(String schemeToken) {
this.schemeToken = schemeToken;
}
 
@Column(name = "PROTOCOL_VERSION_VERSION", unique = false, nullable = true, updatable = false)
private Float version; // TODO: change to integers, e.g. 1.1.1 for future-proof solution
 
public Float getVersion() {
return version;
}
 
private void setVersion(Float version) {
this.version = version;
}
 

Glassfish 4.1
Oracle 12c ojdbc14.jar

Caused by: javax.persistence.PersistenceException: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.5.2.v20140319-9ad6abd): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: ORA-01400: kan ikke sette inn NULL i ("REGUSER"."ABSTRACT_FIELD_VALUE_PART_TABLE"."ID")
 
Error Code: 1400
Call: INSERT INTO ABSTRACT_FIELD_VALUE_PART_TABLE (ID, PROTOCOL_VERSION_SCHEME_TOKEN, PROTOCOL_VERSION_SIP_SCHEME, PROTOCOL_VERSION_VERSION, DTYPE) VALUES (?, ?, ?, ?, ?)
bind => [5 parameters bound]
Query: InsertObjectQuery(SIP/2.0)
at org.eclipse.persistence.internal.jpa.EntityManagerImpl.flush(EntityManagerImpl.java:868)
at com.sun.enterprise.container.common.impl.EntityManagerWrapper.flush(EntityManagerWrapper.java:437)
at no.tobiassenit.sip.registrar.util.EntityMethods.mergeContactSession(EntityMethods.java:66)
 



Trond Arild Lode Tobiassen Heidelberg
 

Problem might ave been reated to missing @Transient on non-persistable guava types.