-->
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: AssertionFailure : possible nonthreadsafe access
PostPosted: Wed Oct 05, 2005 10:05 am 
Newbie

Joined: Wed Oct 05, 2005 9:09 am
Posts: 1
(hibernate 3.0)
I've the error : "AssertionFailure : possible nonthreadsafe access" in the next method that import record in a table oracle from a source file ascii.
The error occur random; sometimes when commit(), save(), rollback(). I don't understand why!

Thanks for attention.
...
Session sexhib = HibernateUtil.getSessionHbm( this.getIdSessioneJeco() );
tx = sexhib.beginTransaction();
...
while( (i_letti = this.leggeRiga( fr, buff )) >= 0 ) {
TracciatoRecordImportDati tra = this.getTracciatiRecord().get( this.nomiFileDaImportare[0] );
tra.setRecord( buff.toString() );

// decido se cancellare fisicamente
app = this.getValoreCampo( this.nomiFileDaImportare[0], "AGGIO_CANC" );

idart = this.getValoreCampo( this.nomiFileDaImportare[0], "ID_ARTICOLO" );
trovato = false;
Articolo art = (Articolo)sexhib.get( Articolo.class, idart, LockMode.UPGRADE );
if( art == null )
art = new Articolo();
else
trovato = true;

boolean errore_record = false;
try {
if( ! fareDelete ) {
descrizione = this.getValoreCampo( this.nomiFileDaImportare[0], "DESCRIZ" );
descbreve = this.getValoreCampo( this.nomiFileDaImportare[0], "DESCRIZ_BREVE" );
idset = this.getValoreCampo( this.nomiFileDaImportare[0], "ID_SETTOREMAG" );
...
SettoreMag setmag = null;
if( idset != null )
setmag = (SettoreMag)sexhib.get( SettoreMag.class, idset, LockMode.READ );
...
art.setIdArticolo(idart);
art.setDescrizioneDefault( descrizione );
art.setDescrizioneBreve( descbreve );
art.setSettoreMag( setmag );
if( !trovato )
sexhib.save( art );
else
sexhib.update( art );
sexhib.flush();
} catch( HibernateException hex ) {
errore_record = true;
errore = true;
giornale.error( "hibernate:save/update/delete articolo " + idart + " : " + hex.getMessage() );
} catch ( Exception ex ) {
errore_record = true;
errore = true;
this.giornale.error( "ciclo di import: articolo " + idart + ": " + ex.getMessage() );
} finally {
if( errore_record ) // && trovato )
sexhib.evict( art );
ret ++;
}

// -------------------------
// COMMITTO la transazione
// -------------------------
if( this.fareCommit( ret ) ) {
boolean fai_rollback = false;
try {
tx.commit();
this.giornale.info("Commit OK : aggiornati "+l_conta_aggiornati+" records");
} catch ( HibernateException hex ) {
fai_rollback = true;
errore = true;
this.giornale.error("commit ERRORE (rollback) nei pressi dell'articolo " + idart + ": " + hex.getMessage() );
} catch ( Throwable exth ) {
fai_rollback = true;
errore = true;
this.giornale.error("commit ERRORE (rollback) nei pressi dell'articolo " + idart, exth );
} finally {
if( fai_rollback )
if( tx != null )
tx.rollback();

sexhib.clear();
l_conta_aggiornati = 0L;
tx = sexhib.beginTransaction();
}
}
}
[/i]


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.