Dear Spring-Users,

i'm trying my first Spring-powerd Hibernate-TestCase, and facing a problem which I can't solve.


Following snippet is the essantial part of my testcase
Code:
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations={"/applicationContext.xml"})
@TransactionConfiguration(transactionManager="transactionManager", defaultRollback=false)
@Transactional
public class HibernateDonorDaoImplTest extends AbstractTransactionalJUnit4SpringContextTests  {
	
	@Autowired 
	private DonorDao donorDao;

	@Autowired
        private SessionFactory sessionFactory;
	
	@BeforeTransaction
	public void onSetUpTransaction() {
		simpleJdbcTemplate.update("insert into Donor (id, lastName) values (?, ?)", 
		new Object[] { 1, "Testmann"});	
	}
	

	@Test
	@Rollback(false)
	public void createDonor(){
		sessionFactory.getCurrentSession().flush();
		sessionFactory.getCurrentSession().clear();  //both lines make no difference
		Donor donor = new Donor("Testguy");
		assertNull(donor.getId());
		Integer id = donorDao.saveDonor(donor);
		assertTrue(id > 0);
	}
my Donor-class looks like this:
Code:
@Entity
public class Donor {
	

	private Integer id;
	private String lastName;


	public Donor (String lastName){
		setLastName(lastName);
	}

       public Donor(){
		
	}

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getLastName() {
		return lastName;
	}

	public void setLastName(String lastName) {
		this.lastName = lastName;
	}
I'm using the H2-DBMS. The Donor-DAO Implementation uses Hibernate to save the Object.

When I execute the testcase with, I recieve following error from H2: "Unique index or primary key violation: "PRIMARY KEY ON PUBLIC.DONOR(ID)" "
If I remove the "simpleJdbcTemplate.update..", the error doesn't appear. Flush and Clear don't change it.

Does anyone know the matter?