DuplicateKeyException during a save

M

melodyBibi

Guest
Hello,

I am French so I took you to excuse me for my bad english.

I use GORM to back occurrences in a database, from an excel file.

Code:
new ExcelBuilder(excelFile.inputStream).eachLine([labels: true, sheet: 0]) {
				if (cell(0)) {
					def nameA = cell(0)
					def nameB = cell(1)
					def a = Chapitre.findByNom(nameA)

					def code = cell(2)
					def designation = cell(3)
			
					if (code == null || nameA == null || nameB == null) {
						flash.messages << "error"
					} else if (!Chapitre.findByNom(nameA)) {
						flash.messages << "error"
					} else if ( Rubrique.where{nom == nameB && chapitre == a}.list().size() == 0) {
						flash.messages << "error"
					} else if(Object.where{rubrique == Rubrique.findByNom(nameB) && c == code && d == designation}.count() > 0){
						flash.messages << "error"
					} else {
					
							def b = Rubrique.findByNom(nameB)
							
							//request.getSession().removeAttribute("nuisanceType")
							def isNew = false;

							Object.withNewSession {session2->
								def object = Object.findOrCreateByCode(code)

								if(object.designation == null)
									isNew = true;
							
								object.rubrique = b
								object.d= (designation == null)?"":designation
//								try	{
									rowCount += object.save()? 1 : 0
//								} catch(ValidationException) {
//									  if(isNew)
//										  rowCount++;
//									  log.info("ErreuRRRRRRRRrrrRRrrRrRRrrrrRrrrRrrrRrrrr")
//								}
							}
					}
				}
				currentLine++
}
flash.messages << "${rowCount} ligne create or update"

An update will break any worries, the course of the lines of file continu and database recording is effective.

However when it comes to inserting a new object I get an error :
" org.springframework.dao.DuplicateKeyException: a different object with the same identifier value was already associated with the session: [fen.NuisanceType#2202]; nested exception is org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session"

The registration of the object in question is effective , but the error raised off the path of the file.

When i uncommented the "try and catch" I bypasses the error and so all my copies of each file are created in the database .

I thus found a way around my worries, but I do not find it very clean and i come to you to try to understand my problem.

Any idea ?

I Thank You in advance
 

ScottGoaws

New member
Greetings from Peacequest Education!

Be the first to enrol for Spoken English or IELTS/ Life coach online classes at PEACEQUEST EDUCATION
Stay safe and overcome your English fever concern with PEACEQUEST!

Courses - AVIATION/HOSPITALITY/RETAIL/TRAVEL, CELPIP,TOEFL,PTE,IELTS,SAT,BASIC ENGLISH/ADVANCE ENGLISH/PERSONALITY GROOMING SESSION/INTERVIEW TECHNIQUES/VOICE & ACCENT/BUSINESS ENGLISH on attractive 50% discounts.

PEACEQUEST EDUCATION provides ONLINE CLASSES WHICH CAN BE AVAILED SITTING AT YOUR PLACE,YOU ARE JUST AT A CLICK AWAY TO JOIN WHICHEVER BAND YOU LOOKING FOR:

Unprecedented sessions with alternate days MOCK TESTS,FREE ONLINE PRACTICE SESSIONS,VOCABULARY, IELTS PRELIMINARY SESSIONS,

HURRY UP TO GRAB YOUR DESIRED SCORE!

Regular classes all 7 days a week

Timings:6am to 9pm

PEACEQUEST EDUCATION New Delhi
Contact 9999828122/7982065847
Website: www.peacequesteducation.org

Best regards
Team Peacequest Education
 
inciclesolmeno thingiverseSupreme Host Whmcs Template Nulled Xenforo https://cdn.thingiverse.com/assets/54/2e/04/76/9f/launch_box_big_box_cracked.html InfatryCargoPorgeGon Download AffolmeftoM Crack Ibm Spss Modeler 142 advarmaDiamezet thingiverse XChat.v2.8.9.Cracked.PROPER-NOY Full Version thingiverse Stereo Tool 7 Keygen thingiverse Pinnacle PCTV MediaCenter Software V.3.4A Serial Key Keygen thingiverse.comenactEcotsindusa thingiverse.com ThemPripsgymnereme Xentry Keymaker V2 1 Developer 20
 
inciclesolmeno DOMACI FILM za gledanje raneGoavydrombdriergo Download InfatryCargoPorgeGon https://cdn.thingiverse.com/assets/72/32/dc/fc/8b/neiail60.html AES-Killer – Burp Plugin To Decrypt AES Encrypted Traffic Of Mobile... thingiverse Space Invaders Extreme License Keygen Free Tukacad Crack Torrent talmud book in urdu free download DOWNLOAD TATKAL TICKET BOOKING SOFTWARE HyloalpSlopleRaign https://cdn.thingiverse.com/assets/72/32/dc/fc/8b/neiail60.html stoovadexmalashoonna DownloadenactEcotsindusa thingiverse.com ThemPripsgymnereme Download
 
inciclesolmeno Sameer 720p movie download utorrentGoavydrombdriergo Download Raduga Po Novomu 3 Testy Rapidshare School Models Rare Sets le seigneur des anneaux les deux tours version longue 1080p Download Free 720p Lekar Hum Deewana Dil Movies Download https://cdn.thingiverse.com/assets/2f/57/c3/18/ad/SHIP_SIMULATOR_EXTREMES_SKIDROW_CRACK_2012_rar.html lumion 2.5 pro crack 64 bits Download HyloalpSlopleRaign https://cdn.thingiverse.com/assets/2f/57/c3/18/ad/SHIP_SIMULATOR_EXTREMES_SKIDROW_CRACK_2012_rar.html stoovadexmalashoonna thingiverseHACK Connectify Hotspot PRO 7.1.29279 Crack-ThumperDC Download cnckad v10 crack Download
 
ex4 to mq4 decompiler 2015 cracked thingiverse.comGoavydrombdriergo thingiverse InfatryCargoPorgeGon pb tool v0.9.20 descargar gratis AffolmeftoM SimpleMind Desktop Pro 1.22.0 Portable crack Al Rassam Al Arabi V31 R1 Keygen thingiverse.com EravyBroowlybrell thingiverse.com HyloalpSlopleRaign thingiverse.com Dabbe - Cin Carpmasi DVDRip (2013) Turkish Horror Movie ENG SubsDabbe - Cin Carpmasi DVDRip (2013) Turkish Horror Movie ENG Subs download kitab kifayatul akhyar pdf editorDownload Geo 5 Crack Download 18 16 Download The Rock Foundry SDX SOUNDBANK thingiverse.com
 
Rope Bondage Rebirth Full Game 1 DownloadGoavydrombdriergo thingiverse Signals And System By Ramesh Babu Pdf Free Download -- thingiverse Sivapuranam Story In Tamil Pdf Download Download advarmaDiamezet https://cdn.thingiverse.com/assets/2c/36/a9/13/a0/si_te_vjedhim_nje_password_facebook.html Skyglobe Download For Windows 7 warcraft 1.26 shuud tatah HyloalpSlopleRaign https://cdn.thingiverse.com/assets/2c/36/a9/13/a0/si_te_vjedhim_nje_password_facebook.html stoovadexmalashoonna DownloadenactEcotsindusa https://cdn.thingiverse.com/assets/2c/36/a9/13/a0/si_te_vjedhim_nje_password_facebook.html Agneepath 1 full movie in hindi 720p download https://cdn.thingiverse.com/assets/2c/36/a9/13/a0/si_te_vjedhim_nje_password_facebook.html
 
inciclesolmeno thingiverseFoto Mosaik Edda Professional Torrent thingiverse dr14 dta corel draw x4 crack fps limiter 0.2 Devkitpro Download https://cdn.thingiverse.com/assets/70/bf/20/8e/88/Thattathin-marayathu-malayalam-full-movie-watch-online-youku.html CRACK RED DEAD REDEMPTION 2 PC DOWNLOAD TORRENT-WINDOWS-MAC OS.mp41.mp4 MacOSX Photodex ProShow Producer 4.52.3048 Serial Key EravyBroowlybrell https://cdn.thingiverse.com/assets/70/bf/20/8e/88/Thattathin-marayathu-malayalam-full-movie-watch-online-youku.html fisica blatt solucionario thingiverse.com the business 2.0 b2 upper intermediate pdf 36 thingiverseenactEcotsindusa thingiverse Terminator 2: Judgment Day (English) in hindi dubbed 720p torrent Ug Nx 8.5 Crack Torrent banque clonage nudge
 
Adobe Photoshop Lightroom CC 6.5.1 Crack [SadeemPC] crack thingiverse.com21 Day Fix Workout Torrent https://cdn.thingiverse.com/assets/6b/3f/1c/22/00/markehauki354.html InfatryCargoPorgeGon thingiverse Wondershare Recoverit 7.1.1.5 Crack [CracksMind] Serial Key keygen thingiverse.com Handy Manny Season 1 Torrent artcam pro 2008 dongle crack Padaiyappa movie in tamil download movies Download badoo credits generator v1.1 download thingiverse.com stoovadexmalashoonna https://cdn.thingiverse.com/assets/6b/3f/1c/22/00/markehauki354.htmlpassion of the christ tamil dubbed hd movie thingiverse ThemPripsgymnereme thingiverse
 
AOMEI OneKey Recovery Professional 1.6.2 Crack [CracksNow] Serial Key Downloadphan mem stcad 4.2 23 Download InfatryCargoPorgeGon thingiverse AffolmeftoM https://cdn.thingiverse.com/assets/68/c7/37/06/c8/talienanc170.html advarmaDiamezet Download mr diker download Download Quick Verse 2010 Platinum thingiverse stoovadexmalashoonna https://cdn.thingiverse.com/assets/68/c7/37/06/c8/talienanc170.htmlEscape Rosecliff Island Activation Code [Patch] thingiverse.com Loopmasters Dubstep Monster Bass Vol 2 Torrent https://cdn.thingiverse.com/assets/68/c7/37/06/c8/talienanc170.html
 
inciclesolmeno thingiverseGoavydrombdriergo Raincad2011crack InfatryCargoPorgeGon Download AffolmeftoM thingiverse.com Club 60 Hindi Full Movie Mp4 Download thingiverse.com EravyBroowlybrell Le Maitre De Latlantide Poseidon Iso initial d extreme stage pc game download Kundli 2012 In Gujarati Full Version With Crack.rar - x-builder framework carrier download software thingiverse.comsimlab sketchup exporter for 3ds max full crack https://cdn.thingiverse.com/assets/a1/a9/e3/c3/bc/saltalis550.html photoprint server pro 5.0 v2 serial number https://cdn.thingiverse.com/assets/a1/a9/e3/c3/bc/saltalis550.html
 
Top