ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Clinton Begin <clinton.be...@gmail.com>
Subject Re: Two separate map configs
Date Sat, 29 Jan 2005 04:59:07 GMT
Dude, the DAO framework is like 500 lines of code.  It's basically a
factory with transaction management.  You'll pick it up in a half
hour.

Clinton


On Fri, 28 Jan 2005 10:23:23 -0500, Akins, Greg <gakins@amervideo.com> wrote:
> To be honest I was intimidated by learning that.
> 
> I had used Hibernate; so apart from getting up to speed on Ibatis; at
> least I was familiar with Persistence layers..
> 
> However, I haven't used a DAO framework and am concerned that I won't be
> able to get up to speed quickly enough.
> 
> -----Original Message-----
> From: Brandon Goodin [mailto:brandon.goodin@gmail.com]
> Sent: Friday, January 28, 2005 10:11 AM
> To: ibatis-user-java@incubator.apache.org
> Subject: Re: Two separate map configs
> 
> 
> yeah... use the DAO framework. :D
> 
> On Thu, 27 Jan 2005 16:55:56 -0500, Akins, Greg <gakins@amervideo.com>
> wrote:
> > OK, I stripped out my DAO objects for the second mapping (and the old
> > tests; and the new tests work... ) leading me to believe that I have
> > not reset an instance of SqlMapClient.
> >
> > I'll have to rewrite my DAO super classes... Can anyone point me to a
> > good pattern for constructing those (since mine obviously sucked:')
> >
> > Thanks for the pointers.
> >
> > -----Original Message-----
> > From: Clinton Begin [mailto:clinton.begin@gmail.com]
> > Sent: Thursday, January 27, 2005 2:12 PM
> > To: Akins, Greg
> > Cc: ibatis-user-java@incubator.apache.org
> > Subject: Re: Two separate map configs
> >
> > Greg,
> >
> > Do you have two SqlMapClient instances?  (you should)
> >
> > Cheers,
> > Clinton
> >
> > On Thu, 27 Jan 2005 13:55:53 -0500, Akins, Greg <gakins@amervideo.com>
> > wrote:
> > > Thanks... I'm not getting any other errors when I run this.  I can
> > > post the rest of the code, but basically I'm Querying by calling
> > >
> > > Object prod = sqlMap.queryForObject("getWare", srchObj.getName()) ;
> > >
> > > And am getting this stacktrace from my tests.
> > >
> > > com.ibatis.sqlmap.client.SqlMapException: There is no statement
> > > named getWare in this SqlMap.
> > >         at
> > > com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.getMappedStatem
> > > en
> > > t(
> > > SqlMapExecutorDelegate.java:288)
> > >         at
> > >
> > com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(Sq
> > lM
> > > apExecutorDelegate.java:552)
> > >         at
> > >
> > com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(Sq
> > lM
> > > apExecutorDelegate.java:536)
> > >         at
> > >
> > com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForObject(SqlMapS
> > es
> > > sionImpl.java:97)
> > >         at
> > >
> > com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryForObject(SqlMapCl
> > ie
> > > ntImpl.java:69)
> > >         at
> > > com.amervideo.ehold.dao.MesBaseDAO.getObject(MesBaseDAO.java:68)
> > >         at
> > > com.amervideo.ehold.dao.WareDAO.getObjectByName(WareDAO.java:22)
> > >         at eHoldTest.TestWareDAO.testGetWare(TestWareDAO.java:39)
> > >         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> Method)
> > >         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown
> Source)
> > >         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown
> > > Source)
> > >         at java.lang.reflect.Method.invoke(Unknown Source)
> > >         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.RemoteTestRunner.runTests(Remote
> > Te
> > > stRunner.java:421)
> > >         at
> > >
> > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestR
> > un
> > > ner.java:305)
> > >         at
> > >
> > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTest
> > Ru
> > > nner.java:186)
> > >
> > > SqlMapsMES.xml
> > > ============================
> > > <?xml version="1.0" encoding="UTF-8"?>
> > >
> > > <!DOCTYPE sqlMapConfig
> > >     PUBLIC "-//iBATIS.com//DTD SQL Map Config  2.0//EN"
> > >     "http://www.ibatis.com/dtd/sql-map-config-2.dtd">
> > >
> > > <sqlMapConfig>
> > >
> > >     <properties resource="mesDb.properties" />
> > >     <transactionManager type="JDBC" >
> > >             <dataSource type="SIMPLE" >
> > >                         <property name="JDBC.Driver"
> > > value="${driver}"/>
> > >                         <property name="JDBC.ConnectionURL"
> > > value="${url}"/>
> > >                         <property name="JDBC.Username"
> > > value="${username}"/>
> > >                         <property name="JDBC.Password"
> > > value="${password}"/>
> > >             </dataSource>
> > >         </transactionManager>
> > >
> > >     <sqlMap resource="com/amervideo/ehold/sql/MoldSQL.xml" />
> > >     <sqlMap resource="com/amervideo/ehold/sql/WareSQL.xml" />
> > >
> > > </sqlMapConfig>
> > >
> > > WareSQL.xml
> > > ============
> > > <?xml version="1.0" encoding="UTF-8" ?>
> > > <!DOCTYPE sqlMap PUBLIC "-//iBatis.com//DTD SQL Map 2.0//EN"
> > >         "http://www.ibatis.com/dtd/sql-map-2.dtd" >
> > >
> > > <sqlMap namespace="Ware">
> > >
> > >         <typeAlias alias="ware" type="com.amervideo.ehold.data.Ware"
> > > />
> > >
> > >         <resultMap id="wareResult" class="ware" >
> > >                 <result property="id" column="laser_id"/>
> > >                 <result property="name" column="laser_id" />
> > >                 <result property="mold" column="mold_id"
> > > select="getMold" />
> > >         </resultMap>
> > >
> > >         <statement id="getWare"
> > >                 resultMap="wareResult" >
> > >                 select laser_id, mold_id
> > >                 from av21.mes_2d_ware_tracking
> > >                 where laser_id = #name#
> > >         </statement>
> > >
> > > </sqlMap>
> > >
> > > -----Original Message-----
> > > From: Clinton Begin [mailto:clinton.begin@gmail.com]
> > > Sent: Thursday, January 27, 2005 1:33 PM
> > > To: ibatis-user-java@incubator.apache.org
> > > Subject: Re: Two separate map configs
> > >
> > > Can you post the xml files?
> > >
> > > Clinton
> > >
> > > On Thu, 27 Jan 2005 13:11:27 -0500, Akins, Greg
> > > <gakins@amervideo.com>
> > > wrote:
> > > >
> > > > I have two separate map config files
> > > >
> > > > SqlMapsLocal.xml & SqlMapsMES.xml
> > > >
> > > > The mappings defined by local work fine.
> > > >
> > > > There are two maps in SqlMapsMES.xml
> > > >
> > > > When I try to access those queries I get a SqlMapException "There
> > > > is
> >
> > > > no statement named "xxxx" in this SqlMap.
> > > >
> > > > From what I can tell, it's reading the MapConfig OK, and the
> > > > SqlMap element is similar to other ones I have working.  No other
> > > > errs, just the "No Statement".
> > > >
> > > > Any idea what is going wrong here?
> > > >
> > > >
> > > > Greg Akins
> > > > Software Engineer
> > > > Sony Electronics, STP Systems
> > > > 724.696.7322 (Sony)
> > > > 724.696.6147 (AV)
> > > > 724.454.7790 (Cell)
> > > > 412.590.3973 (Pager)
> > > >
> > >
> > >
> >
>

Mime
View raw message