-->
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.  [ 2 posts ] 
Author Message
 Post subject: Null Pointer Exception at AbstractBatcher.closePreparedState
PostPosted: Fri Mar 30, 2007 1:09 pm 
Newbie

Joined: Tue Mar 27, 2007 6:48 pm
Posts: 3
Location: Richardson
I am getting this expcetion, when trying to insert a simple statement into SQL Server2000 with hibrante-mapping for ID generator class as [b]identity or native[/b] from a [b]Websphere container [/b]either with a Webspehere embedded JDBC driver or JTDC driver for SQLServer.

From outside the container it works fine either with Microsoft or JTDC drivers. But with Webspehere embedded JDBC driver it gives [i]Unsupported method: Connection.prepareStatement[/i] exception.

Additional information :
1. I have seen it working okay even in the container with JTDC drivers, but using DBCP connection pooling.
2. It works okay in the container for generator class="increment"
3. I see this log statement just before the expcetion ?!!
30 Mar 2007 10:27:53,344 INFO org.hibernate.type.StringType - could not bind value 'sdffasdf' to parameter: 1; null

This same issue was posted, wayback in 2005 but ended up with no resolution. Appreciate any insight into this issue.

[b]Hibernate version:[/b]

3.0.5, 3.1.2, 3.2.2

[b]Mapping documents:[/b]
<hibernate-mapping package="com.hcsc.eppsrw.integration.dto">
<class name="DemoDTO" table="DEMO">
<id name="id" column="ID" type="long" unsaved-value="undefined">
<generator class="identity" />
</id>
<property name="name" length="20"/>
<property name="description" />
<property name="status" />
</class>
</hibernate-mapping>

[b]Code between sessionFactory.openSession() and session.close():[/b]

public void save(DemoDTO demoDto) {
getHibernateTemplate().save(demoDto);
}


[b]Full stack trace of any exception that occurs:[/b]
Caused by: java.lang.NullPointerException
at org.hibernate.jdbc.AbstractBatcher.closePreparedStatement(AbstractBatcher.java:471)
at org.hibernate.jdbc.AbstractBatcher.closeStatement(AbstractBatcher.java:218)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:1981)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2405)
at org.hibernate.action.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:37)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:248)
at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:269)
at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:167)
at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:101)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:186)
at org.hibernate.event.def.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:33)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:175)
at org.hibernate.event.def.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:27)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:70)
at org.hibernate.impl.SessionImpl.fireSave(SessionImpl.java:530)
at org.hibernate.impl.SessionImpl.save(SessionImpl.java:518)
at org.hibernate.impl.SessionImpl.save(SessionImpl.java:514)
at org.springframework.orm.hibernate3.HibernateTemplate$12.doInHibernate(HibernateTemplate.java:625)
at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:362)
at org.springframework.orm.hibernate3.HibernateTemplate.save(HibernateTemplate.java:622)

[b]Name and version of the database you are using:[/b]
Microsoft SQLServer2000


Top
 Profile  
 
 Post subject: Work around for the issue is hibernate.jdbc.use_get_generate
PostPosted: Fri Mar 30, 2007 5:15 pm 
Newbie

Joined: Tue Mar 27, 2007 6:48 pm
Posts: 3
Location: Richardson
After setting this proeprty, the commit was successful.

hibernate.jdbc.use_get_generate=false

Enable use of JDBC3 PreparedStatement.getGeneratedKeys() to retrieve natively generated keys after insert. Requires JDBC3+ driver and JRE1.4+, set to false if your driver has problems with the Hibernate identifier generators. By default, tries to determine the driver capabilites using connection metadata.

Thanks to my colleague, who helped me walk through hiberante code n debugging the issue.

Exception handliing !!


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

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.