SQLJ template: Java 5 support
Is SQLJ template project active.
If yes, then following enchancement needs to be done
a) Support for Java 5
b) parameters or arugments to query methods of sqlTemplate for passing parameters. (currently we have define all parameters as final)
c) General code for iterator and context, so that each SQL DAO need not define them.
1 Attachment(s)
SQLJTemplate generic source code
I have uploaded modified source code for generic support for SQLJ template
I have tested this by writing sample application.
I wanted to know procedure for running junit test cases.
When I tried running sqlj test case on old code and new code I am getting error while executing sqljtemplate code
java.lang.AssertionError:
Unexpected method call prepareStatement("SELECT AGE FROM CUSTMR WHERE ID = 3", 1003, 1007):
prepareStatement("SELECT AGE FROM CUSTMR WHERE ID = 3"): expected: 1, actual: 0
isClosed(): expected: 1, actual: 0
at org.easymock.internal.MockInvocationHandler.invoke (MockInvocationHandler.java:43)
at org.easymock.internal.ObjectMethodsFilter.invoke(O bjectMethodsFilter.java:72)
at $Proxy0.prepareStatement(Unknown Source)
at sqlj.runtime.profile.ref.JDBCProfile.prepareStatem ent(JDBCProfile.java:303)
at sqlj.runtime.profile.ref.JDBCProfile.getStatement( JDBCProfile.java:203)
at sqlj.runtime.profile.ref.JDBCProfile.getStatement( JDBCProfile.java:239)
at sqlj.runtime.profile.ref.ProfileWrapper.getStateme nt(ProfileWrapper.java:113)
at sqlj.runtime.profile.ref.IterConvertProfile.getSta tement(IterConvertProfile.java:79)
at sqlj.runtime.profile.ref.ProfileWrapper.getStateme nt(ProfileWrapper.java:113)
at sqlj.runtime.profile.ref.UntypedSelectProfile.getS tatement(UntypedSelectProfile.java:56)
at sqlj.runtime.profile.ref.ProfileWrapper.getStateme nt(ProfileWrapper.java:113)
at sqlj.runtime.profile.ref.ParamRegProfile.getStatem ent(ParamRegProfile.java:61)
at sqlj.runtime.profile.ref.PositionedProfile.getStat ement(PositionedProfile.java:128)
at sqlj.runtime.profile.ref.TransactionControlProfile .getStatement(TransactionControlProfile.java:147)
at sqlj.runtime.ExecutionContext$StatementStack.setSt atement(ExecutionContext.java:1172)
at sqlj.runtime.ExecutionContext.registerStatement(Ex ecutionContext.java:695)
at org.springextensions.sqlj.core.SqljTemplateQueryTe sts$7.sqljSelectIntoClause(SqljTemplateQueryTests. java:801)
at org.springextensions.sqlj.core.SqljTemplate$1Query ForObjectConnectionCallback.doInConnection(SqljTem plate.java:501)
at org.springextensions.sqlj.core.SqljTemplate.execut eConnectionCallback(SqljTemplate.java:408)
at org.springextensions.sqlj.core.SqljTemplate.queryF orObject(SqljTemplate.java:504)
at org.springextensions.sqlj.core.SqljTemplate.queryF orInt(SqljTemplate.java:513)
at org.springextensions.sqlj.core.SqljTemplateQueryTe sts.testQueryForInt(SqljTemplateQueryTests.sqlj:47 4)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:79)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:618)
at junit.framework.TestCase.runTest(TestCase.java:164 )
at junit.framework.TestCase.runBare(TestCase.java:130 )
at junit.framework.TestResult$1.protect(TestResult.ja va:106)
at junit.framework.TestResult.runProtected(TestResult .java:124)
at junit.framework.TestResult.run(TestResult.java:109 )
at junit.framework.TestCase.run(TestCase.java:120)
at junit.framework.TestSuite.runTest(TestSuite.java:2 30)
at junit.framework.TestSuite.run(TestSuite.java:225)
at org.eclipse.jdt.internal.junit.runner.junit3.JUnit 3TestReference.run(JUnit3TestReference.java:130)
at org.eclipse.jdt.internal.junit.runner.TestExecutio n.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.runTests(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.runTests(RemoteTestRunner.java:673)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.run(RemoteTestRunner.java:386)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.main(RemoteTestRunner.java:196)