Hello good people i came accross a weird behaviour in my test.I'm using JPA hibernate annotation
with spring
.
let say i have an Class MyObject and it's property email is marqued
@Column(name="EMAIL", length=100, unique=true)
private String email;
i prepare for what i need to be in the database in the setup of this class MyObjectDAOImplTest
@Autowired
MyObject1 ob1;
@Autowired
MyObject1 ob2;
@Before
public void setUP(){
dao = manager.createthedao();
....
ob1.setEmail("[email protected]");
....
....
ob2.setEmail("[email protected]");
....
dao.save(ob1);
dao.save(ob2);
}
so my a part from the fist test method all the reste are failling.I's about duplicates values on the email column but my hbm2ddl.auto=create and i even used the create-drop. but still. i just don't get it. i've used this in so many project without the unique of course but i expect the database to be dropped each time a test method is run.Is there anything about the unique i should be aware of ? thanks for reading.Give me your suggestion.Did i left out something or fail to do some?