if I take a clean schema and write a simple test case it seems to work just fine. However if I run against the production schema (which has a ton of data) I get the exception still.
production is using this version of mysql + hibernate:
mysql Server version: 5.0.45
hibernate-3.3.0 sp1
hibernate annotations 3.4.0 ga
my SongStat class is annotated like this:
Code:
@Entity
@Table(name="song_stats")
public class SongStats
{
@Id @GeneratedValue
public Long getId()
{
return id;
}
public void setId(Long id)
{
this.id = id;
}
@ManyToOne()
@JoinColumn(name="song_id")
public Song getSong()
{
return song;
}
My sortie class is annotated this way:
Code:
@Entity
@Table(name="sortie")
public class Sortie
{
protected Long sortieId;
protected Date startDate;
protected Date endDate;
protected DataFeed dataFeed;
protected String description;
protected Date lastUpdate;
public Sortie()
{
}
public Sortie(DataFeed feed)
{
super();
this.dataFeed = feed;
startDate = new Date();
}
public Sortie(Date startDate, Long feedId)
{
super();
this.startDate = startDate;
}
@Id @GeneratedValue
@Column(name="sortie_id")
public Long getId()
{
return sortieId;
}
The strange thing is that if I persist 2 song stats the first one works fine and the second one fails:
Code:
008-12-21 16:44:15,375 [main] DEBUG (ate.impl.SessionImpl:247) - opened session at timestamp: 5037653423616000
2008-12-21 16:44:15,375 [main] DEBUG (tion.JDBCTransaction:82) - begin
2008-12-21 16:44:15,375 [main] DEBUG (bc.ConnectionManager:444) - opening JDBC connection
2008-12-21 16:44:15,384 [main] DEBUG (tion.JDBCTransaction:87) - current autocommit status: true
2008-12-21 16:44:15,385 [main] DEBUG (tion.JDBCTransaction:90) - disabling autocommit
2008-12-21 16:44:15,386 [main] DEBUG (actSaveEventListener:320) - executing identity-insert immediately
2008-12-21 16:44:15,386 [main] DEBUG (jdbc.AbstractBatcher:410) - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
2008-12-21 16:44:15,387 [main] DEBUG (l.SQLStatementLogger:111) - insert into song_stats (song_id, sortie_id, total_plays) values (?, ?, ?)
2008-12-21 16:44:15,429 [main] DEBUG (fierGeneratorFactory:95) - Natively generated identity: 10
2008-12-21 16:44:15,430 [main] DEBUG (jdbc.AbstractBatcher:418) - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
2008-12-21 16:44:15,431 [main] DEBUG (tion.JDBCTransaction:134) - commit
2008-12-21 16:44:15,431 [main] DEBUG (lushingEventListener:134) - processing flush-time cascades
2008-12-21 16:44:15,431 [main] DEBUG (lushingEventListener:177) - dirty checking collections
2008-12-21 16:44:15,432 [main] DEBUG (lushingEventListener:108) - Flushed: 0 insertions, 0 updates, 0 deletions to 1 objects
2008-12-21 16:44:15,432 [main] DEBUG (lushingEventListener:114) - Flushed: 0 (re)creations, 0 updates, 0 removals to 0 collections
2008-12-21 16:44:15,433 [main] DEBUG (rnate.pretty.Printer:106) - listing entities:
2008-12-21 16:44:15,433 [main] DEBUG (rnate.pretty.Printer:113) - com.company.spring.model.SongStats{sortie=com.company.spring.model.Sortie#74, totalPlays=56292, song=com.company.spring.model.Song#251210, lastUpdate=null, id=10}
2008-12-21 16:44:15,444 [main] DEBUG (tion.JDBCTransaction:227) - re-enabling autocommit
2008-12-21 16:44:15,445 [main] DEBUG (tion.JDBCTransaction:147) - committed JDBC Connection
2008-12-21 16:44:15,445 [main] DEBUG (bc.ConnectionManager:325) - transaction completed on session with on_close connection release mode; be sure to close the session to release JDBC resources!
2008-12-21 16:44:15,446 [main] DEBUG (bc.ConnectionManager:464) - releasing JDBC connection [ (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)]
2008-12-21 16:44:15,447 [main] DEBUG (bc.ConnectionManager:325) - transaction completed on session with on_close connection release mode; be sure to close the session to release JDBC resources!
2008-12-21 16:44:15,447 [main] DEBUG (ent.JavaAgent:113) - new stats for song [Song] title: Last Goodbye (sourceId: 744111) , plays: 56292
2008-12-21 16:44:15,448 [main] DEBUG (lushingEventListener:134) - processing flush-time cascades
2008-12-21 16:44:15,448 [main] DEBUG (lushingEventListener:177) - dirty checking collections
2008-12-21 16:44:15,449 [main] DEBUG (lushingEventListener:108) - Flushed: 0 insertions, 0 updates, 0 deletions to 3 objects
2008-12-21 16:44:15,449 [main] DEBUG (lushingEventListener:114) - Flushed: 0 (re)creations, 0 updates, 0 removals to 0 collections
2008-12-21 16:44:15,450 [main] DEBUG (rnate.pretty.Printer:106) - listing entities:
2008-12-21 16:44:15,450 [main] DEBUG (rnate.pretty.Printer:113) - com.company.spring.model.DataFeed{url=www.myspace.com, lastUpdate=2008-12-02 11:01:07, name=MySpace, id=1}2008-12-21 16:44:15,451 [main] DEBUG (rnate.pretty.Printer:113) - com.company.spring.model.Song{sourceId=744111, title=Last Goodbye, songId=251210, dataFeed=com.company.spring.model.DataFeed#1, album=null, url=http://media.myspace.com/services/media/mediahitcounter.ashx?i=MIGdBgorBgEEAYI3WAPWoIGOMIGLBgorBgEEAYI3WAMBoH0wewIDAgABAgJmAwICAMAECPGsEKfGUi%2ffBBDEvQeSTuH1x2dzb2G9GXKvBFCqHsZbqQjlHm%2bacS9B2XyDFLnmlclw%2fscDKdc0%2b9%2bFN45EUWy072vbV2ND9FzadbE83aOMjgUyWBtK4K6XNuiim%2fPkwleep6XrZe4pwlvbFQ%3d%3d, lastUpdate=2008-1
2-19 13:05:46, feedBandId=1}2008-12-21 16:44:15,452 [main] DEBUG (rnate.pretty.Printer:113) - com.company.spring.model.Band{friendId=12401025, homeCountry=null, homeState=null, homeCity=null, officialSite=null, lastUpdate=2008-12-12 17:12:27, profile=null, name=Autographs & Apologies, id=1
}
2008-12-21 16:44:15,452 [main] DEBUG (jdbc.AbstractBatcher:410) - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)2008-12-21 16:44:15,452 [main] DEBUG (l.SQLStatementLogger:111) - select this_.song_id as song1_33_3_, this_.album_id as album7_33_3_, this_.feed_id as feed8_33_3_, this_.feed_band_id as feed2_33_3_, this_.last_update as last3_33_3_, this_.source_id as source4_33_3_, this_.title as title33_3_, this_.url as url33_3_, album2_.album_id as album1_2_0_, album2_.feed_id as feed9_2_0_, album2_.feed_band_id as feed2_2_0_, album2_.last_update as last3_2_0_, album2_.producer as producer2_0_, album2_.source_id as source5_2_0_, album2_.title as title2_0_, album2_.url as url2_0_, album2_.year as year2_0_, datafeed3_.id as id8_1_, datafeed3_.last_update as last2_8_1_, datafeed3_.name as name8_1_, datafeed3_.url as url8_1_, datafeed4_.id as id8_2_, datafeed4_.last_update as last2_8_2_, datafeed4_.name as name8_2_, datafeed4_.url as url8_2_ from song this_ left outer join album album2_ on this_.album_id=album2_.album_id left outer join data_feed datafeed3_ on album2_.feed_id=datafeed3_.id left outer join data_feed datafeed4_ on this_.feed_id=datafe
ed4_.id where this_.source_id=? and this_.feed_id=? and this_.feed_band_id=?
2008-12-21 16:44:15,454 [main] DEBUG (jdbc.AbstractBatcher:426) - about to open ResultSet (open ResultSets: 0, globally: 0)
2008-12-21 16:44:15,455 [main] DEBUG (ernate.loader.Loader:1197) - result row: null, null, EntityKey[com.company.spring.model.DataFeed#1], EntityKey[com.company.spring.model.Song#251211]
2008-12-21 16:44:15,456 [main] DEBUG (jdbc.AbstractBatcher:433) - about to close ResultSet (open ResultSets: 1, globally: 1)
2008-12-21 16:44:15,456 [main] DEBUG (jdbc.AbstractBatcher:418) - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
2008-12-21 16:44:15,457 [main] DEBUG (.engine.TwoPhaseLoad:130) - resolving associations for [com.company.spring.model.Song#251211]
2008-12-21 16:44:15,457 [main] DEBUG (.engine.TwoPhaseLoad:226) - done materializing entity [com.company.spring.model.Song#251211]
2008-12-21 16:44:15,458 [main] DEBUG (ulPersistenceContext:860) - initializing non-lazy collections2008-12-21 16:44:15,458 [main] INFO (ent.JavaAgent:110) - sortie = [Sortie] id: 74, dataFeed: [DataFeed] id: 1, name: MySpace, url: www.myspace.com, lastUpdate: 2008-12-02 11:01:07.0, startDate: 2008-12-21 16:44:13.0, desc: spring test myspace job sortie agent
persisted agent persisted
2008-12-21 16:44:15,459 [main] DEBUG (ate.impl.SessionImpl:247) - opened session at timestamp: 5037653423960064
2008-12-21 16:44:15,459 [main] DEBUG (tion.JDBCTransaction:82) - begin
2008-12-21 16:44:15,459 [main] DEBUG (bc.ConnectionManager:444) - opening JDBC connection
2008-12-21 16:44:15,473 [main] DEBUG (tion.JDBCTransaction:87) - current autocommit status: true
2008-12-21 16:44:15,473 [main] DEBUG (tion.JDBCTransaction:90) - disabling autocommit
2008-12-21 16:44:15,479 [main] DEBUG (actSaveEventListener:320) - executing identity-insert immediately
2008-12-21 16:44:15,480 [main] DEBUG (jdbc.AbstractBatcher:410) - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
008-12-21 16:44:15,480 [main] DEBUG (l.SQLStatementLogger:111) - insert into song_stats (song_id, sortie_id, total_plays) values (?, ?, ?)
2008-12-21 16:44:15,495 [main] DEBUG (jdbc.AbstractBatcher:418) - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
2008-12-21 16:44:15,497 [main] DEBUG (DBCExceptionReporter:92) - could not insert: [com.company.spring.model.SongStats] [insert into song_stats (song_id, sortie_id, total_plays) values (?, ?, ?)]
java.sql.SQLException: Duplicate entry '74' for key 2
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2926)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1571)
at com.mysql.jdbc.ServerPreparedStatement.serverExecute(ServerPreparedStatement.java:1120)
at com.mysql.jdbc.ServerPreparedStatement.executeInternal(ServerPreparedStatement.java:675)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1162)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1079)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1064)
at org.hibernate.id.IdentityGenerator$GetGeneratedKeysDelegate.executeAndExtract(IdentityGenerator.java:94)
at org.hibernate.id.insert.AbstractReturningDelegate.performInsert(AbstractReturningDelegate.java:57)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2186)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2666)
at org.hibernate.action.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:71)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:279)
at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:321)
at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:204)
at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:130)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:210)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:195)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:117)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:93)
at org.hibernate.impl.SessionImpl.fireSaveOrUpdate(SessionImpl.java:534)
at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:526)
at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:522)
at com.company.spring.dao.GenericHibernateDAO.makePersistent(GenericHibernateDAO.java:154)
at com.company.spring.dao.SongStatsDaoImpl.makePersistent(SongStatsDaoImpl.java:9)
at com.company.spring.service.StatService.add(StatService.java:65)
at com.company.spring.service.StatService$$FastClassByCGLIB$$a45dca3a.invoke(<generated>)
at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:695)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:144)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:107)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:166)
at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:630)
at com.company.spring.service.StatService$$EnhancerByCGLIB$$c00ccaa6.add(<generated>)
at com.company.spring.agent.JavaAgent.processSongs(JavaAgent.java:112)
at com.company.spring.agent.JavaAgent.processData(JavaAgent.java:154)
at com.company.spring.agent.AgentImpl.processProfileUpdateJob(AgentImpl.java:207)
at com.company.spring.agent.AgentImpl.processSingleProfileJobs(AgentImpl.java:274)
at com.company.spring.agent.AgentImpl.process(AgentImpl.java:349)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:293)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:177)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:144)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:107)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:166)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at $Proxy25.process(Unknown Source)
at com.company.spring.test.AgentTest.testAgent(AgentTest.java:248)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at junit.framework.TestCase.runTest(TestCase.java:164)
at junit.framework.TestCase.runBare(TestCase.java:130)
at org.springframework.test.ConditionalTestCase.runBare(ConditionalTestCase.java:69)
at junit.framework.TestResult$1.protect(TestResult.java:110)
at junit.framework.TestResult.runProtected(TestResult.java:128)
at junit.framework.TestResult.run(TestResult.java:113)
at junit.framework.TestCase.run(TestCase.java:120)
at junit.framework.TestSuite.runTest(TestSuite.java:228)
at junit.framework.TestSuite.run(TestSuite.java:223)
at junit.textui.TestRunner.doRun(TestRunner.java:115)
at junit.textui.TestRunner.start(TestRunner.java:179)
at junit.textui.TestRunner.main(TestRunner.java:137)
2008-12-21 16:44:15,499 [main] WARN (DBCExceptionReporter:100) - SQL Error: 1062, SQLState: 23000
2008-12-21 16:44:15,500 [main] ERROR (DBCExceptionReporter:101) - Duplicate entry '74' for key 2
2008-12-21 16:44:15,501 [main] DEBUG (tion.JDBCTransaction:186) - rollback
2008-12-21 16:44:15,502 [main] DEBUG (tion.JDBCTransaction:227) - re-enabling autocommit
2008-12-21 16:44:15,502 [main] DEBUG (tion.JDBCTransaction:197) - rolled back JDBC Connection
2008-12-21 16:44:15,503 [main] DEBUG (bc.ConnectionManager:325) - transaction completed on session with on_close connection release mode; be sure to close the session to release JDBC resources!
2008-12-21 16:44:15,503 [main] DEBUG (bc.ConnectionManager:464) - releasing JDBC connection [ (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)]
2008-12-21 16:44:15,504 [main] DEBUG (bc.ConnectionManager:325) - transaction completed on session with on_close connection release mode; be sure to close the session to release JDBC resources!
2008-12-21 16:44:15,504 [main] ERROR (ent.JavaAgent:117) - problem processing song [Song] title: Forever Yours (sourceId: 744164) , plays: 26798
org.hibernate.exception.ConstraintViolationException: could not insert: [com.company.spring.model.SongStats]
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:94)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
at org.hibernate.id.insert.AbstractReturningDelegate.performInsert(AbstractReturningDelegate.java:64)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2186)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2666)
at org.hibernate.action.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:71)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:279)
at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:321)
at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:204)
at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:130)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:210)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:195)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:117)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:93)
at org.hibernate.impl.SessionImpl.fireSaveOrUpdate(SessionImpl.java:534)
at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:526)
at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:522)
at com.company.spring.dao.GenericHibernateDAO.makePersistent(GenericHibernateDAO.java:154)
at com.company.spring.dao.SongStatsDaoImpl.makePersistent(SongStatsDaoImpl.java:9)
at com.company.spring.service.StatService.add(StatService.java:65)
at com.company.spring.service.StatService$$FastClassByCGLIB$$a45dca3a.invoke(<generated>)
at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:695)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:144)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:107)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:166)
at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:630)
at com.company.spring.service.StatService$$EnhancerByCGLIB$$c00ccaa6.add(<generated>)
at com.company.spring.agent.JavaAgent.processSongs(JavaAgent.java:112)
at com.company.spring.agent.JavaAgent.processData(JavaAgent.java:154)
at com.company.spring.agent.AgentImpl.processProfileUpdateJob(AgentImpl.java:207)
at com.company.spring.agent.AgentImpl.processSingleProfileJobs(AgentImpl.java:274)
at com.company.spring.agent.AgentImpl.process(AgentImpl.java:349)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:293)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:177)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:144)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:107)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:166)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at $Proxy25.process(Unknown Source)
at com.company.spring.test.AgentTest.testAgent(AgentTest.java:248)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at junit.framework.TestCase.runTest(TestCase.java:164)
at junit.framework.TestCase.runBare(TestCase.java:130)
at junit.framework.TestCase.runBare(TestCase.java:130)
at org.springframework.test.ConditionalTestCase.runBare(ConditionalTestCase.java:69)
at junit.framework.TestResult$1.protect(TestResult.java:110)
at junit.framework.TestResult.runProtected(TestResult.java:128)
at junit.framework.TestResult.run(TestResult.java:113)
at junit.framework.TestCase.run(TestCase.java:120)
at junit.framework.TestSuite.runTest(TestSuite.java:228)
at junit.framework.TestSuite.run(TestSuite.java:223)
at junit.textui.TestRunner.doRun(TestRunner.java:115)
at junit.textui.TestRunner.start(TestRunner.java:179)
at junit.textui.TestRunner.main(TestRunner.java:137)
Caused by: java.sql.SQLException: Duplicate entry '74' for key 2
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2926)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1571)
at com.mysql.jdbc.ServerPreparedStatement.serverExecute(ServerPreparedStatement.java:1120)
at com.mysql.jdbc.ServerPreparedStatement.executeInternal(ServerPreparedStatement.java:675)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1162)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1079)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1064)
at org.hibernate.id.IdentityGenerator$GetGeneratedKeysDelegate.executeAndExtract(IdentityGenerator.java:94)
at org.hibernate.id.insert.AbstractReturningDelegate.performInsert(AbstractReturningDelegate.java:57)
... 58 more
I'm baffled.