-->
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.  [ 35 posts ]  Go to page Previous  1, 2, 3
Author Message
 Post subject:
PostPosted: Tue May 01, 2007 11:00 am 
Senior
Senior

Joined: Sat Apr 21, 2007 11:01 pm
Posts: 144
For all date comparisons you should convert it to ms and compare the long anyway. >.>

_________________
Everytime you get an answer to your question without giving credit; god kills a kitten. :(


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 01, 2007 11:13 am 
Beginner
Beginner

Joined: Wed Feb 14, 2007 10:43 am
Posts: 21
This is what we get. And this is what -181/22007 means:

An invalid datetime format was detected; that is, an invalid string representation or value was specified.

============================================

Caused by: com.ibm.db2.jcc.a.SqlException: DB2 SQL error: SQLCODE: -181, SQLSTATE: 22007, SQLERRMC: null
at com.ibm.db2.jcc.a.cq.d(cq.java:1234)
at com.ibm.db2.jcc.c.bc.k(bc.java:345)
at com.ibm.db2.jcc.c.bc.a(bc.java:63)
at com.ibm.db2.jcc.c.q.a(q.java:64)
at com.ibm.db2.jcc.c.bp.c(bp.java:266)
at com.ibm.db2.jcc.a.cr.V(cr.java:1412)
at com.ibm.db2.jcc.a.cr.d(cr.java:1939)
at com.ibm.db2.jcc.a.cr.R(cr.java:440)
at com.ibm.db2.jcc.a.cr.executeUpdate(cr.java:423)
at org.hibernate.jdbc.NonBatchingBatcher.addToBatch(NonBatchingBatcher.java:23)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2062)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2427)
at org.hibernate.action.EntityInsertAction.execute(EntityInsertAction.java:51)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:248)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:232)
at org.hibernate.engine.ActionQueue.executeInserts(ActionQueue.java:130)
at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:222)
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)


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 01, 2007 4:15 pm 
Beginner
Beginner

Joined: Wed Feb 14, 2007 10:43 am
Posts: 21
OK, I went through the DB2390Dialect. What needs to be overridden or added to create a custom dialect? And is this the preferred way to solve my problem?

public boolean supportsSequences() {
return false;
}

public String getIdentitySelectString() {
return "select identity_val_local() from sysibm.sysdummy1";
}

public boolean supportsLimit() {
return true;
}

public boolean supportsLimitOffset() {
return false;
}

public String getLimitString(String sql, int offset, int limit) {
return new StringBuffer(sql.length() + 40)
.append(sql)
.append(" fetch first ")
.append(limit)
.append(" rows only ")
.toString();
}

public boolean useMaxForLimit() {
return true;
}

public boolean supportsVariableLimit() {
return false;
}


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 02, 2007 8:39 am 
Expert
Expert

Joined: Tue Jul 11, 2006 10:21 am
Posts: 457
Location: Columbus, Ohio
Going to have to look deeper than that, the DB2390 Dialect extends the DB2Dialect. Look at that class, it is more complete.


Top
 Profile  
 
 Post subject: Re: DateTime
PostPosted: Tue Aug 10, 2010 1:22 pm 
Newbie

Joined: Tue Aug 10, 2010 1:16 pm
Posts: 1
I know this is an old thread, but I figured I'd post my experience so that I can remember it as well.

I, too, was having the same DB2 exception when attempting to insert a date/timestamp value. The error was:

SQL0181 SQLCODE -181 SQLSTATE 22007

Explanation: Value in date, time, or timestamp string not valid.

It turns out that I needed to specify the Temporal type in the mapping (i.e. @Temporal(TemporalType.TIMESTAMPE). Once I modified my mappings, all saved properly using the DB2Dialect.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 35 posts ]  Go to page Previous  1, 2, 3

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.