Here's an extract from my sql config file: ################### <insert id="insertModule" parameterClass="com.test.dto.Module"> INSERT INTO tbl_Module ( module_id, module_credits, module_semester, module_level, module_description ) VALUES ( #id#, #credits#, #semester#, #year#, #description# ) </insert> ###################
I've tried a few variations of this, for example using statement tag instead of the insert tag. On a positive note I think I've worked out why the transactions bit was failing - I was using old SQL Map Config 1.0 dtd that doesn't have a transaction tag (that I know of), instead of the new 2,0 (which does)... Unfortunately when I run my code I get a NoClassDefFound error with regards to my BaseDAO, although when I put a print statement in the static bit at the top that loads in the sql config file it is still printed - so surely the file is there? Below is an extract from both the old and new config files. In the old one the datasource refers to <ResourceParams> in the server.xml file. Can anyone suggest how can make the second one equilivent, or make it so I can remove the information from the server.xml file to somewhere within my project. ## Old ## <datasource name="sisDatasource" factory-class="....JndiDataSourceFactory" default="true" > <property name="DBInitialContext" value= "java:comp/env" /> <property name="DBLookup" value="${DatabaseJNDIPath}"/> </datasource> ## New ## <transactionManager type="JDBC"> <dataSource type="JNDI"> <property name="DBInitialContext" value= "java:comp/env" /> <property name="DBLookup" value="${DatabaseJNDIPath}"/> </dataSource> </transactionManager> Tim Christopher On Sun, 20 Feb 2005 21:37:57 -0700, Larry Meadors <[EMAIL PROTECTED]> wrote: > The code there is: > > === > MappedStatement ms = (MappedStatement) mappedStatements.get(id); > if (ms == null) { > throw new SqlMapException("There is no statement named " + id + > " in this SqlMap."); > } > return ms; > === > > Looks like you have a sqlmap, but that the statement "insertModule" is > not in it. > > Make sure you have the sqlmap that contains the "insertModule" > statement in your SqlMapConfig.xml file. > > Larry > > On Mon, 21 Feb 2005 04:28:08 +0000, Tim Christopher > <[EMAIL PROTECTED]> wrote: > > Hi, > > > > I'm in the middle of incorporating iBATIS into my Struts project, but > > am having slight trouble in getting it to work. > > > > The problem starts when I call sqlMap.startTransaction() from within > > my BaseDAO file as I get a null pointer exception... Yet when I print > > out the value of sqlMap I get something like > > "[EMAIL PROTECTED]" - not null as > > I would have expected given the null pointer error. Sadly I do not > > know of any methods I can call that show the state of the sqlMap. > > > > Having made various small alterations to the code to try and get it to > > work I eventually tried removing the line to start the transaction... > > However this resulted in the following error: > > > > com.ibatis.sqlmap.client.SqlMapException: There is no statement named > > insertModule in this SqlMap. > > > > ...SqlMapExecutorDelegate.getMappedStatement(SqlMapExecutorDelegate.java:288) > > ...SqlMapExecutorDelegate.update(SqlMapExecutorDelegate.java:491) > > ...SqlMapSessionImpl.update(SqlMapSessionImpl.java:89) > > ...SqlMapClientImpl.update(SqlMapClientImpl.java:61) > > ...com.xyz.BaseDAO.update(BaseDAO.java:101) > > <snip/> > > > > This leaves me at a point where I'm not certain if this means there is > > a problem with my XML config file (ie. it's looking, but can't find > > the statement), or if it looking in an empty object - though I'm > > guessing (hoping) that fixing the first null pointer error should make > > it all work fine. > > > > Any help / suggestions apreciated. > > > > Tim Christopher > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]