I believe if you use negative numbers for the id's it may solve this problem. Has anyone else (using Oracle) had issues with the tutorial?
Thanks, Matt On 12/10/07, 王金胜 <[EMAIL PROTECTED]> wrote: > > > > > > Hi, Raible : > > > > appfuse 2.0.1 AppFuse Modular Application > > > > > > PersonAtionTest.java > > public class PersonActionTest extends BaseActionTestCase { > > private PersonAction action; > > @Override > > protected void onSetUpBeforeTransaction() throws Exception { > > super.onSetUpBeforeTransaction (); > > action = new PersonAction(); > > GenericManager personManager = (GenericManager) > > applicationContext.getBean("personManager"); > > action.setPersonManager(personManager); > > // add a test person to the database > > Person person = new Person(); > > person.setFirstName("Jack"); > > person.setLastName("Raible"); > > person.setBirthday(new Date()); > > personManager.save(person); > > > System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> > hello!"); > > > > } > > > > public void testSearch() throws Exception { > > assertEquals(action.list(), ActionSupport.SUCCESS); > > assertTrue(action.getPersons().size() >= 1); > > } > > public void testEdit() throws Exception { > > log.debug("testing edit..."); > > action.setId(1L); > > assertNull(action.getPerson()); > > assertEquals("success", action.edit()); > > assertNotNull(action.getPerson ()); > > assertFalse(action.hasActionErrors()); > > } > > public void testSave() throws Exception { > > MockHttpServletRequest request = new MockHttpServletRequest(); > > ServletActionContext.setRequest (request); > > action.setId(1L); > > assertEquals("success", action.edit()); > > assertNotNull(action.getPerson()); > > // update last name and save > > action.getPerson().setLastName("Updated Last Name"); > > assertEquals("input", action.save()); > > assertEquals("Updated Last Name", > action.getPerson().getLastName()); > > assertFalse(action.hasActionErrors()); > > assertFalse( action.hasFieldErrors ()); > > assertNotNull(request.getSession().getAttribute("messages")); > > } > > > > public void testRemove() throws Exception { > > MockHttpServletRequest request = new MockHttpServletRequest(); > > ServletActionContext.setRequest(request); > > action.setDelete(""); > > Person person = new Person(); > > person.setId(2L); > > action.setPerson(person); > > assertEquals("success", action.delete()); > > assertNotNull(request.getSession().getAttribute("messages")); > > } > > > > } > > when pom.xml setting mysql database > > > > > <dbunit.dataTypeFactoryName>org.dbunit.dataset.datatype.DefaultDataTypeFactory > </dbunit.dataTypeFactoryName> > > > <dbunit.operation.type>CLEAN_INSERT</dbunit.operation.type> > > > <hibernate.dialect>org.hibernate.dialect.MySQL5InnoDBDialect</hibernate.dialect> > > <jdbc.groupId>mysql</jdbc.groupId> > > > <jdbc.artifactId>mysql-connector-java</jdbc.artifactId> > > <jdbc.version>5.0.5</jdbc.version> > > <jdbc.driverClassName >com.mysql.jdbc.Driver</jdbc.driverClassName> > > > <jdbc.url><![CDATA[jdbc:mysql://localhost/changhua?createDatabaseIfNotExist=true&useUnicode=true&characterEncoding=utf-8]]></jdbc.url> > > <jdbc.username>root</jdbc.username> > > <jdbc.password>newpw</jdbc.password> > > > > command line : > > >mvn test -Dtest=PersonActionTest > > screen out look at attach1.txt > > > > Test is SUCCESSFUL ! > PersonActionTest.onSetUpBeforeTransaction() at every > testMethod is execute once。 > > person's id @GeneratedValue(strategy= GenerationType.AUTO) > > out println > > >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> > hello! > > >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> > hello! > > >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> > hello! > > >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> > hello! > > 4 once; > > > > When pom.xml setting oracle 9i database > > > > > <dbunit.dataTypeFactoryName>org.dbunit.ext.oracle.OracleDataTypeFactory</dbunit.dataTypeFactoryName> > > < dbunit.operation.type > >CLEAN_INSERT</dbunit.operation.type> > > > <dbunit.schema>WANGJAVAFANS</dbunit.schema><!-- Make sure > to capitalize the schema name--> > > < hibernate.dialect> > org.hibernate.dialect.Oracle9Dialect</hibernate.dialect> > > <jdbc.groupId>com.oracle</jdbc.groupId> > > <jdbc.artifactId>ojdbc14</jdbc.artifactId> > > < jdbc.version>9.1.0.2.0</jdbc.version> > > > <jdbc.driverClassName>oracle.jdbc.OracleDriver</jdbc.driverClassName> > > <jdbc.url><![CDATA[ jdbc:oracle:thin:@10.13.20.51 > :1521:fish]]></jdbc.url> > > <jdbc.username>wangjavafans</jdbc.username> > > <jdbc.password>wangjava</jdbc.password> > > command line : > > >mvn test -Dtest=PersonActionTest > > screen out look at attach2.txt > > Test is FAILURE! > PersonActionTest.onSetUpBeforeTransaction() at every > testMethod is execute once。 > > person's id @GeneratedValue(strategy= GenerationType.AUTO) > > out println > > >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> > hello! > > >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> > hello! > > 2 once; > > out tell me is java.sql.BatchUpdateException: ORA-00001: 违反唯一约束条件 > (WANGJAVAFANS.SYS_C008990) > > > > > > > > Why ? > > Thank you's answer ! > > > > > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: > [EMAIL PROTECTED] > For additional commands, e-mail: > [EMAIL PROTECTED] > >