Dear team,
I want use das to implement a general create method like in Hibernate.
I get java.lang.NullPointerException
at
org.apache.tuscany.das.rdb.impl.ApplyChangesCommandImpl.execute(ApplyChangesCommandImpl.java:59)
at org.apache.tuscany.das.rdb.impl.DASImpl.applyChanges(DASImpl.java:244)
at
com.hollycrm.platform.dao.impl.TuscanyEntityDaoImpl$1.doInConnection(TuscanyEntityDaoImpl.java:30)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:230)
at
com.hollycrm.platform.dao.impl.TuscanyEntityDaoImpl.add(TuscanyEntityDaoImpl.java:26)
at
com.hollycrm.platform.dao.impl.TuscanyEntityDaoImplTest.testAdd(TuscanyEntityDaoImplTest.java:43)
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:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at
org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:128)
at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
when I test a example as follow:
...
public void testAdd() throws Exception{
InputStream is = ClassLoader.getSystemResourceAsStream("company.xsd");
List types = XSDHelper.INSTANCE.define(is, null);
is.close();
Type companyType = TypeHelper.INSTANCE.getType("company.xsd",
"CompanyType");
DataObject company = DataFactory.INSTANCE.create(companyType);
company.setString("name", "ACME");
company.setString("id", "E0001");
dao.add(company);
}
...
public void add(final DataObject object) {
this.getJdbcTemplate().execute(new ConnectionCallback(){
public Object doInConnection(Connection conn) throws SQLException,
DataAccessException {
conn.setAutoCommit(false);
DAS das = DAS.FACTORY.createDAS(getConfig(object), conn);
das.applyChanges(object);
return object;
}
});
}
How can I correct it?
3ks
lazet
2007/06/25