-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: NullPointerException @ org.hibernate.type.IntegerType.next()
PostPosted: Mon Dec 18, 2006 3:41 pm 
Newbie

Joined: Fri Dec 15, 2006 7:07 pm
Posts: 7
Location: Luxembourg
Dear all

With Hiberate 3.1 I am getting a java.lang.NullPointerException
at org.hibernate.type.IntegerType.next(IntegerType.java:59)
when executing save() and flush() on an object which has just been created.


All docs and comments talk about a wrong unsaved-value mapping. But what does that mean?
I cannot really see anything.

At the moment I call save(); flush(); the version uc is null which is mapped as unsaved-value.

Could someone possibly point out some details which I overlooked? What could be wrong?

Any advice would be gratefully appreciated.

Markus


///////////////////////////////////////////////////////////////////////////
HBM mapping
///////////////////////////////////////////////////////////////////////////
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping
>
<class
name="com.softwareag.belgium.seibud.rmg.dao.AmdDeponentDAO"
table="DEPONENTS"
>
<id
name="id"
column="ID_DEPONENT"
>
<!-- The generator-class attribute of @hibernate.id is deprecated, use the @hibernate.generator tag instead -->
<generator class="assigned">
</generator>
</id>
<version
name="updateCounter"
column="uc"
type="java.lang.Integer"
unsaved-value="null"
/>
<property
name="memberId"
column="ID_MEMBER"
>
</property>
<property
name="isRapporteur"
column="BL_RAPPORTEUR"
>
</property>
<property
name="instanceType"
column="TP_INSTANCE"
>
</property>
<property
name="bodyId"
column="ID_BODY"
>
</property>
<property
name="amendmentId"
column="ID_AMENDMENT"
>
</property>
<property
name="deponentNumber"
column="NO_DEPONENT"
>
</property>
<property
name="state"
column="state"
>
</property>
<property
name="lastUpdateTimestamp"
column="ts"
>
</property>
</class>
</hibernate-mapping>



///////////////////////////////////////////////////////////////////////////
Stack trace
///////////////////////////////////////////////////////////////////////////
20:35:19,775 DEBUG [bo] Changing state for AmdDeponent:499730 from null to created
20:35:19,775 DEBUG [bo] Persisting object AmdDeponent:499730 with uc=null, ts=null and state=created
20:35:19,790 ERROR [RqstLogger] rqstId: R1166470431361-4; status: failed (SysErr)
20:35:19,790 ERROR [RqstLogger] java.lang.NullPointerException
at org.hibernate.type.IntegerType.next(IntegerType.java:59)
at org.hibernate.engine.Versioning.increment(Versioning.java:25)
at org.hibernate.event.def.DefaultFlushEntityEventListener.getNextVersion(DefaultFlushEntityEventListener.java:360)
at org.hibernate.event.def.DefaultFlushEntityEventListener.scheduleUpdate(DefaultFlushEntityEventListener.java:250)
at org.hibernate.event.def.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:121)
at org.hibernate.event.def.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:195)
at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:76)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:26)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:993)
at com.softwareag.belgium.seibud.rmg.bo.BaseBO.xdoPersist(BaseBO.java:273)
at com.softwareag.belgium.seibud.rmg.bo.AmdDeponent.postCreate(AmdDeponent.java:995)
at com.softwareag.belgium.seibud.rmg.bo.AmdDeponent.create(AmdDeponent.java:979)
at com.softwareag.belgium.seibud.rmg.bo.AmdItem._modifyDeponents_nocheckSignificance(AmdItem.java:3110)
at com.softwareag.belgium.seibud.rmg.bo.AmdItem.modifyDeponents_nocheckSignificance(AmdItem.java:9241)
at com.softwareag.belgium.seibud.rmg.bo.AmdItem.createAmendment(AmdItem.java:810)
at com.softwareag.belgium.seibud.rmg.bo.AmdItem._addNew(AmdItem.java:431)
at com.softwareag.belgium.seibud.rmg.bo.AmdItem._addNew_syncwrapper(AmdItem.java:457)
at com.softwareag.belgium.seibud.rmg.bo.AmdItem.addNew_syncwrapper(AmdItem.java:7303)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)


///////////////////////////////////////////////////////////////////////////
DAO code
///////////////////////////////////////////////////////////////////////////
/**
* Representation of a deponent.
*
* @hibernate.class table="DEPONENTS"
*
*/
public final class AmdDeponentDAO extends
com.softwareag.belgium.seibud.rmg.dao.BaseDAO {

protected String state;
private Integer updateCounter;
private Date lastUpdateTimestamp;

private Integer amendmentId;
private Integer deponentNumber;
private Integer bodyId;
private Integer memberId;
private String instanceType;
private Boolean isRapporteur;

/**
* @return String state
*
* @hibernate.property column="state"
*/
public String getState() {
return state;
}

/**
* @param newState
* new state
*/
public void setState(String newState) {
state = newState;
}

/**
* @return Integer update counter
*
* @hibernate.version column="uc" unsaved-value="null"
*/
public Integer getUpdateCounter() {
return updateCounter;
}

/**
* @param l
* new update counter
*/
protected void setUpdateCounter(Integer l) {
updateCounter = l;
}

/**
* @return Date of last update
*
* @hibernate.property column="ts"
*/
public Date getLastUpdateTimestamp() {
return lastUpdateTimestamp;
}

/**
* @param date
* of update
*/
public void setLastUpdateTimestamp(Date date) {
lastUpdateTimestamp = date;
}

/**
* Returns the value of memberId.
* @hibernate.property
* column="ID_MEMBER"
*/
public Integer getMemberId() {
return memberId;
}

/**
* Sets the value of memberId.
* @param memberId The value to assign memberId.
*/
public void setMemberId(Integer memberId) {
this.memberId = memberId;
}

/**
* Returns the value of isRapporteur.
* @hibernate.property
* column="BL_RAPPORTEUR"
*/
public Boolean getIsRapporteur() {
return isRapporteur;
}

/**
* Sets the value of isRapporteur.
* @param isRapporteur The value to value isRapporteur.
*/
public void setIsRapporteur(Boolean isRapporteur) {
this.isRapporteur = isRapporteur;
}

/**
* Returns the value of instanceType.
* @hibernate.property
* column="TP_INSTANCE"
*/
public String getInstanceType() {
return instanceType;
}

/**
* Sets the value of instanceType.
* @param instanceType The value to instanceType name.
*/
public void setInstanceType(String instanceType) {
this.instanceType = instanceType;
}

/**
* Returns the value of bodyId.
* @hibernate.property
* column="ID_BODY"
*/
public Integer getBodyId() {
return bodyId;
}

/**
* Sets the value of bodyId.
* @param bodyId The value to assign bodyId.
*/
public void setBodyId(Integer bodyId) {
this.bodyId = bodyId;
}

/**
* Returns the value of amendmentId.
* @hibernate.property
* column="ID_AMENDMENT"
*/
public Integer getAmendmentId() {
return amendmentId;
}

/**
* Sets the value of amendmentId.
* @param amendmentId The value to assign amendmentId.
*/
public void setAmendmentId(Integer amendmentId) {
this.amendmentId = amendmentId;
}

/**
* Returns the value of deponentNumber.
* @hibernate.property
* column="NO_DEPONENT"
*/
public Integer getDeponentNumber() {
return deponentNumber;
}

/**
* Sets the value of deponentNumber.
* @param deponentNumber The value to deponentNumber actionId.
*/
public void setDeponentNumber(Integer deponentNumber) {
this.deponentNumber = deponentNumber;
}

private Integer id;

/**
* @return the item DeponenentId
*
* @hibernate.id
* column="ID_DEPONENT"
* generator-class="assigned"
*/
public String getId() {
return id.toString();
}
public Integer getIdInt() {
return id;
}

public void setId(String string) {
id = new Integer(string);
}

public String getDeponentId() {
return getId();
}

public Integer getDeponentIdInt() {
return id;
}

/**
* @return the name of the business class managing this DAO object.
*/
public String getBOClassName() {
return "AmdDeponent";
}

public String toString() {
return "AmdDeponent:" + getId();
}

}

_________________
Markus
SW Developer and wine maker
http://www.jostock.net


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.