-->
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.  [ 9 posts ] 
Author Message
 Post subject: Transaction problem
PostPosted: Mon Mar 20, 2006 11:47 am 
Regular
Regular

Joined: Fri Sep 30, 2005 6:15 am
Posts: 50
Hi,

I use HibernateUtil in my webapp to manage my Hibernate Session.

Everything was working fine but with the following code (that I have simplified just to make it clearer for you), I have an error "could not insert"


Quote:
Session session = HibernateUtil.currentSession(); //get session from Hibernate Util
Transaction tx = session.beginTransaction();

for (int i=0; i<100; i++){

Employee employee = new Employee (list of parameters);

boolean isExist = myQueryManager.isEmployeeAlreadyExist(employee);// method that also use the session from HibernateUtil.currentSession

if (isExist){
tx.update(employee);
} else {
tx.insert(employee);
}

}

tx.commit();




The problem is that the method "isEmployeeAlreadyExist()" raise an error saying : "could not insert" and say that "data has been truncated"...I can't understand because this method only do a "select"

The strange thing is that I got this error only when the "Employee" table is empty and when I try to insert more than 10 employees in my loops.
However, if the table already has 20 rows, I can even insert 100 employees without any problem...

So It looks like my session don't have time to do the insert before the select....is itpossible?

can you see my mistake?

Thank you very much for trying helping!


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 20, 2006 12:40 pm 
Pro
Pro

Joined: Mon Jan 24, 2005 5:39 am
Posts: 216
Location: Germany
If your method performs a select, hibernate may perform a flush i.e.
insert. Can you post the log with show_sql enabled ?

_________________
dont forget to rate !


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 20, 2006 12:54 pm 
Regular
Regular

Joined: Fri Sep 30, 2005 6:15 am
Posts: 50
Hi,

Thank you for your reply!

The log is quite big but I can answer, yes, I can see something like this :

SELECT * from employee ....
INSERT into employee....
SELECT * from employee ....
INSERT into employee....
SELECT * from employee ....
INSERT into employee....


and after 10 times it crashes with the error "could not insert"
But as I told before, it crashes only when table "employee" is empty, if the "employee" tables has some rows (more than 10 I think)..it works....

have you any idea?

Thanks!!


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 21, 2006 4:15 am 
Regular
Regular

Joined: Fri Sep 30, 2005 6:15 am
Posts: 50
should I use two different session?

Thanks...


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 21, 2006 4:47 am 
Pro
Pro

Joined: Mon Jan 24, 2005 5:39 am
Posts: 216
Location: Germany
Can you post the stacktrace you get ?
There must be an error in your code,
maybe you create and save two instances
with the same primary key, or something like
that. Two sessions will usually not help in this case.

_________________
dont forget to rate !


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 21, 2006 6:38 am 
Regular
Regular

Joined: Fri Sep 30, 2005 6:15 am
Posts: 50
Hello,

Thanks for trying to help,

As you was talking about "flush", I have tried to add a "session.flush()" after "session.update(employee)" and "session.save(employee)"
but i still have an error, below is the error :

Quote:
[21/03/06 09:28:29:516 CET] 6c7d4c1e SystemOut O Hibernate: select dnasalary0_.PKWDNASALP as PKWDNASALP, dnasalary0_.LAST_UPDATE as LAST2_21_, dnasalary0_.CAMPAGNE as CAMPAGNE21_, dnasalary0_.NUMEROADHERENT as NUMEROAD4_21_, dnasalary0_.NUMEROLIGNE as NUMEROLI5_21_, dnasalary0_.NOMSALARIEDNA as NOMSALAR6_21_, dnasalary0_.PRENOMSALARIEDNA as PRENOMSA7_21_, dnasalary0_.NUMEROSECURITESOCIALE as NUMEROSE8_21_, dnasalary0_.SUFFIXESECURITESOCIALE as SUFFIXES9_21_, dnasalary0_.CLENUMEROSECURITESOCIALE as CLENUME10_21_, dnasalary0_.ADRESSE1DNA as ADRESSE11_21_, dnasalary0_.ADRESSE2DNA as ADRESSE12_21_, dnasalary0_.ADRESSE3DNA as ADRESSE13_21_, dnasalary0_.CODEPOSTALDNA as CODEPOS14_21_, dnasalary0_.LOCALITEDNA as LOCALIT15_21_, dnasalary0_.MAJIDENTITE as MAJIDEN16_21_, dnasalary0_.DATEENTREE as DATEENTREE21_, dnasalary0_.DATESORTIE as DATESORTIE21_, dnasalary0_.QUALIFICATION as QUALIFI19_21_, dnasalary0_.CLASSIFICATIONTP as CLASSIF20_21_, dnasalary0_.PROFESSION as PROFESSION21_, dnasalary0_.ABATTEMENT as ABATTEMENT21_, dnasalary0_.CODEHM as CODEHM21_, dnasalary0_.SALAIREBASE as SALAIRE24_21_, dnasalary0_.TEMPSTRAVAIL as TEMPSTR25_21_, dnasalary0_.SALAIRETOTAL as SALAIRE26_21_, dnasalary0_.TEMPSINTEMPERIES as TEMPSIN27_21_, dnasalary0_.INDEMNITEINTEMPERIES as INDEMNI28_21_, dnasalary0_.TEMPSACCIDENTTRAVAIL as TEMPSAC29_21_, dnasalary0_.TEMPSACCIDENTTRAJET as TEMPSAC30_21_, dnasalary0_.TEMPSMALADIEPROFESSIONNELLE as TEMPSMA31_21_, dnasalary0_.TEMPSMATERNITE as TEMPSMA32_21_, dnasalary0_.TEMPSMALADIENONPROFESSIONNELLE as TEMPSMA33_21_, dnasalary0_.NUMEROBLEU as NUMEROBLEU21_, dnasalary0_.CONVENTIONCOLLECTIVE as CONVENT35_21_, dnasalary0_.NUMERODOSSIER as NUMEROD36_21_, dnasalary0_.ETAT as ETAT21_, dnasalary0_.NOUVEAUSALARIE as NOUVEAU38_21_, dnasalary0_.SIECLEMAJLIGNE as SIECLEM39_21_, dnasalary0_.ANNEEMAJLIGNE as ANNEEMA40_21_, dnasalary0_.MOISMAJLIGNE as MOISMAJ41_21_, dnasalary0_.JOURMAJLIGNE as JOURMAJ42_21_, dnasalary0_.TYPEMAJLIGNE as TYPEMAJ43_21_ from DNASALARIES dnasalary0_ where dnasalary0_.CAMPAGNE=? and dnasalary0_.NUMEROADHERENT=? and dnasalary0_.NUMEROSECURITESOCIALE=? order by dnasalary0_.NOMSALARIEDNA

[21/03/06 09:28:29:531 CET] 6c7d4c1e SystemErr R Salarié '1631075120229' non trouvé dans la base de données (=> INSERT)

[21/03/06 09:28:29:578 CET] 6c7d4c1e SystemOut O Hibernate: insert into DNASALARIES (LAST_UPDATE, CAMPAGNE, NUMEROADHERENT, NUMEROLIGNE, NOMSALARIEDNA, PRENOMSALARIEDNA, NUMEROSECURITESOCIALE, SUFFIXESECURITESOCIALE, CLENUMEROSECURITESOCIALE, ADRESSE1DNA, ADRESSE2DNA, ADRESSE3DNA, CODEPOSTALDNA, LOCALITEDNA, MAJIDENTITE, DATEENTREE, DATESORTIE, QUALIFICATION, CLASSIFICATIONTP, PROFESSION, ABATTEMENT, CODEHM, SALAIREBASE, TEMPSTRAVAIL, SALAIRETOTAL, TEMPSINTEMPERIES, INDEMNITEINTEMPERIES, TEMPSACCIDENTTRAVAIL, TEMPSACCIDENTTRAJET, TEMPSMALADIEPROFESSIONNELLE, TEMPSMATERNITE, TEMPSMALADIENONPROFESSIONNELLE, NUMEROBLEU, CONVENTIONCOLLECTIVE, NUMERODOSSIER, ETAT, NOUVEAUSALARIE, SIECLEMAJLIGNE, ANNEEMAJLIGNE, MOISMAJLIGNE, JOURMAJLIGNE, TYPEMAJLIGNE, PKWDNASALP) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)

[21/03/06 09:28:29:844 CET] 6c7d4c1e JDBCException W org.hibernate.util.JDBCExceptionReporter SQL Error: -99999, SQLState: 22001

[21/03/06 09:28:29:844 CET] 6c7d4c1e JDBCException E org.hibernate.util.JDBCExceptionReporter [IBM][CLI Driver] CLI0109E Données de chaîne tronquées à droite. SQLSTATE=22001

[21/03/06 09:28:29:844 CET] 6c7d4c1e AbstractFlush E org.hibernate.event.def.AbstractFlushingEventListener Could not synchronize database state with session

[21/03/06 09:28:29:875 CET] 6c7d4c1e AbstractFlush E org.hibernate.event.def.AbstractFlushingEventListener TRAS0014I: L'exception suivante a été consignée : org.hibernate.exception.GenericJDBCException: could not insert:
[org.ccpb14.fwk.base.mapping.Dnasalary]
at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:82)
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:70)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.persister.entity.BasicEntityPersister.insert(BasicEntityPersister.java:1869)
at org.hibernate.persister.entity.BasicEntityPersister.insert(BasicEntityPersister.java:2200)
at org.hibernate.action.EntityInsertAction.execute(EntityInsertAction.java:46)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java(Compiled Code))
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:136)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:274)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:730)
at org.ccpb14.fwk.dna.dadsu.DadsuLoader.loadDnasalarys(DadsuLoader.java:5859)
at org.ccpb14.fwk.dna.dadsu.DadsuLoader.load(DadsuLoader.java:226)
at org.ccpb14.entreprises.dna.actions.DnaDadsuLoaderAction.execute(DnaDadsuLoaderAction.java:66)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:421)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:226)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
at com.ibm.ws.webcontainer.servlet.ServicingServletState.service(StrictLifecycleServlet.java:333)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:1068)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:598)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:206)
at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1056)
at org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:388)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:231)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
at com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:76)
at org.ccpb14.hibernate.HibernateFilter.doFilter(HibernateFilter.java:59)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:132)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:71)
at org.ccpb14.filters.LoginFilter.doFilter(LoginFilter.java:101)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:132)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:71)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:1064)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:598)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:206)
at com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java:80)
at com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:214)
at com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:71)
at com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:182)
at com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java:334)
at com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java:56)
at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:623)
at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:447)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:672)
Caused by: COM.ibm.db2.jdbc.DB2Exception: [IBM][CLI Driver] CLI0109E Données de chaîne tronquées à droite. SQLSTATE=22001
at COM.ibm.db2.jdbc.app.SQLExceptionGenerator.throw_SQLException(SQLExceptionGenerator.java:275)
at COM.ibm.db2.jdbc.app.SQLExceptionGenerator.throw_SQLException(SQLExceptionGenerator.java(Inlined Compiled Code))
at COM.ibm.db2.jdbc.app.SQLExceptionGenerator.check_return_code(SQLExceptionGenerator.java(Compiled Code))
at COM.ibm.db2.jdbc.app.DB2PreparedStatement.execute2(DB2PreparedStatement.java(Compiled Code))
at COM.ibm.db2.jdbc.app.DB2PreparedStatement.executeUpdate(DB2PreparedStatement.java:1736)
at com.ibm.ws.rsadapter.jdbc.WSJdbcPreparedStatement.executeUpdate(WSJdbcPreparedStatement.java:462)
at org.hibernate.jdbc.NonBatchingBatcher.addToBatch(NonBatchingBatcher.java:22)
at org.hibernate.persister.entity.BasicEntityPersister.insert(BasicEntityPersister.java:1853)
... 59 more
.
org.hibernate.exception.GenericJDBCException: could not insert: [org.ccpb14.fwk.base.mapping.Dnasalary]
at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:82)
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:70)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.persister.entity.BasicEntityPersister.insert(BasicEntityPersister.java:1869)
at org.hibernate.persister.entity.BasicEntityPersister.insert(BasicEntityPersister.java:2200)
at org.hibernate.action.EntityInsertAction.execute(EntityInsertAction.java:46)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java(Compiled Code))
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:136)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:274)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:730)
at org.ccpb14.fwk.dna.dadsu.DadsuLoader.loadDnasalarys(DadsuLoader.java:5859)
at org.ccpb14.fwk.dna.dadsu.DadsuLoader.load(DadsuLoader.java:226)
at org.ccpb14.entreprises.dna.actions.DnaDadsuLoaderAction.execute(DnaDadsuLoaderAction.java:66)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:421)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:226)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
at com.ibm.ws.webcontainer.servlet.ServicingServletState.service(StrictLifecycleServlet.java:333)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:1068)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:598)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:206)
at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1056)
at org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:388)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:231)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
at com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:76)
at org.ccpb14.hibernate.HibernateFilter.doFilter(HibernateFilter.java:59)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:132)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:71)
at org.ccpb14.filters.LoginFilter.doFilter(LoginFilter.java:101)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:132)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:71)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:1064)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:598)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:206)
at com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java:80)
at com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:214)
at com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:71)
at com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:182)
at com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java:334)
at com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java:56)
at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:623)
at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:447)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:672)
Caused by: COM.ibm.db2.jdbc.DB2Exception: [IBM][CLI Driver] CLI0109E Données de chaîne tronquées à droite. SQLSTATE=22001
at COM.ibm.db2.jdbc.app.SQLExceptionGenerator.throw_SQLException(SQLExceptionGenerator.java:275)
at COM.ibm.db2.jdbc.app.SQLExceptionGenerator.throw_SQLException(SQLExceptionGenerator.java(Inlined Compiled Code))
at COM.ibm.db2.jdbc.app.SQLExceptionGenerator.check_return_code(SQLExceptionGenerator.java(Compiled Code))
at COM.ibm.db2.jdbc.app.DB2PreparedStatement.execute2(DB2PreparedStatement.java(Compiled Code))
at COM.ibm.db2.jdbc.app.DB2PreparedStatement.executeUpdate(DB2PreparedStatement.java:1736)
at com.ibm.ws.rsadapter.jdbc.WSJdbcPreparedStatement.executeUpdate(WSJdbcPreparedStatement.java:462)
at org.hibernate.jdbc.NonBatchingBatcher.addToBatch(NonBatchingBatcher.java:22)
at org.hibernate.persister.entity.BasicEntityPersister.insert(BasicEntityPersister.java:1853)
... 59 more


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 21, 2006 6:41 am 
Regular
Regular

Joined: Fri Sep 30, 2005 6:15 am
Posts: 50
Hello again steckemetz,

Just to specify that I don't think I save two times the same primary key because I got this error when my table is empty....and when my table is not empty, I don't get any error...strange....I was thinking that the INSERT statement don't have enough time to "flush" before the select begins...

what do you think about this? is it a possible cause?

Thanks again!


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 21, 2006 9:15 am 
Regular
Regular

Joined: Fri Sep 30, 2005 6:15 am
Posts: 50
Hi,
I found the problem and...it was my mistake...really sorry....

I was trying to insert a value too long for the columns some times...
I got the answer by setting the log4j to get the SQL parameters values...

Really sorry to disturb I was really thinking on a bigger problem..

Just a little question if you can answer me quickly, do you think it's better to flush after each insert ?

Thank you very much...I'll be rating you...


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 21, 2006 10:25 am 
Pro
Pro

Joined: Mon Jan 24, 2005 5:39 am
Posts: 216
Location: Germany
No problem !

Quote:
Just a little question if you can answer me quickly, do you think it's better to flush after each insert ?


Flush is an expensive i.e. time consuming operation, so it is usually
better to flush after a specific unit of work.

_________________
dont forget to rate !


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 9 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.