Hi,
I am new to Spring Roo. I have created a project using this tool. My project has two domain objects: Person and Address. Person has a reference to Address. When I use Mysql and Hibernate, all my integration tests fail. But if I change database from mysql to hypersonic-in-memory all integration tests are ok (i mean pass). Can anyone please explains me this is happenning ?
Here is my integration test for Person:
package com.foo.neoroo.domain;
import java.util.Date;
import javax.sql.DataSource;
import junit.framework.Assert;
import org.springframework.beans.factory.annotation.Autow ired;
import org.springframework.jdbc.core.simple.SimpleJdbcTem plate;
import org.springframework.roo.addon.test.RooIntegrationT est;
import com.foo.neoroo.domain.Person;
import org.junit.Test;
@RooIntegrationTest(entity = Person.class)
public class PersonIntegrationTest {
private SimpleJdbcTemplate jdbcTemplate;
@Autowired
public void initializePersonIntegrationTest(DataSource ds){
jdbcTemplate = new SimpleJdbcTemplate(ds);
}
@Test
public void testMarkerMethod() {
int count = jdbcTemplate.queryForInt("select count(0) from Person");
Person person = new Person();
person.setFirstName("Sanjoy");
person.setLastName("Roy");
person.setDateCreated(new Date());
person.setDateUpdated(new Date());
person.persist();
count = jdbcTemplate.queryForInt("select count(0) from Person");
Assert.assertEquals(1, count);
System.out.println(person);
}
}
Integration Test for Address
package com.foo.neoroo.domain;
import javax.sql.DataSource;
import junit.framework.Assert;
import org.springframework.beans.factory.annotation.Autow ired;
import org.springframework.jdbc.core.simple.SimpleJdbcTem plate;
import org.springframework.roo.addon.test.RooIntegrationT est;
import com.foo.neoroo.domain.Address;
import org.junit.Test;
@RooIntegrationTest(entity = Address.class)
public class AddressIntegrationTest {
private SimpleJdbcTemplate jdbcTemplate;
@Autowired
public void initializeAddressIntegrationTest(DataSource ds){
jdbcTemplate = new SimpleJdbcTemplate(ds);
}
@Test
public void testMarkerMethod() {
int count = jdbcTemplate.queryForInt("select count(0) from Address");
Address address = new Address();
address.setHouseNo("70");
address.setPostcode("sd2 3ds");
address.persist();
System.out.println(address);
int count1 = jdbcTemplate.queryForInt("select count(0) from Address");
System.out.println(address);
Assert.assertEquals(1, count1);
}
}
Thanks in advance.
Cheers
Sanjoy


. But if I change database from mysql to hypersonic-in-memory all integration tests are ok (i mean pass). Can anyone please explains me this is happenning ? 
Reply With Quote