|
View:
New views
9 Messages
—
Rating Filter:
Alert me
|
|
|
iBatis API for fetching the sqlmap queriesHi,
We are using iBatis 3 with Spring.
We wish to provide our DAOs with both, Spring's JdbcTemplate and iBatis SqlMapClientTemplate facilities.
Does iBatis provide a way to fetch the queries defined in one of the xmls using the id attribute programmatically?
Any help is highly appreciated.
Regards,
Mahesh
|
|
|
Re: iBatis API for fetching the sqlmap queriesYes, you can introspect on the full iBATIS configuration at runtime by grabbing the Configuration instance from the SqlSessionFactory. It has lists and maps of various configuration components.
Clinton
On Sun, Nov 1, 2009 at 10:07 PM, Mahesh219 <maheshforjava@...> wrote: Hi, We are using iBatis 3 with Spring. We wish to provide our DAOs with both, Spring's JdbcTemplate and iBatis SqlMapClientTemplate facilities. Does iBatis provide a way to fetch the queries defined in one of the xmls using the id attribute programmatically? Any help is highly appreciated. Regards, Mahesh |
|
|
ibatis 3 petstoreIs there a sample application written in ibatis 3 and spring such as petstore?
thanks --------------------------------------------------------------------- To unsubscribe, e-mail: user-java-unsubscribe@... For additional commands, e-mail: user-java-help@... |
|
|
ibatis 3 COUNT -> BooleanI'm trying to do the following using beta 5 (this was working in beta 3)
@Select("SELECT COUNT(username) FROM record WHERE username = #{username,jdbcType=VARCHAR}") Boolean isExisting(String username); I get a ClassCastException: java.lang.Long cannot be cast to java.lang.Boolean which is understandable. I thought adding a @Result(javaType = Boolean.class) would do it but I still get the same error. Can I do anything short of changing the return type to a Long and doing the conversion? Thanks -Doug --------------------------------------------------------------------- To unsubscribe, e-mail: user-java-unsubscribe@... For additional commands, e-mail: user-java-help@... |
|
|
|
|
|
Re: ibatis 3 COUNT -> BooleanYou could just modify the query to return a boolean value to avoid
conversion issues. For example: SELECT IF(COUNT(username)>0,true,false) FROM record WHERE ... Am 04.11.2009, 19:42 Uhr, schrieb Douglas Bell <DBell@...>: > I'm trying to do the following using beta 5 (this was working in beta 3) > > @Select("SELECT COUNT(username) FROM record WHERE username = > #{username,jdbcType=VARCHAR}") > Boolean isExisting(String username); > > I get a ClassCastException: java.lang.Long cannot be cast to > java.lang.Boolean which is understandable. > > I thought adding a @Result(javaType = Boolean.class) would do it but I > still get the same error. Can I do anything short of changing the return > type to a Long and doing the conversion? > > Thanks > > -Doug > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-java-unsubscribe@... > For additional commands, e-mail: user-java-help@... > --------------------------------------------------------------------- To unsubscribe, e-mail: user-java-unsubscribe@... For additional commands, e-mail: user-java-help@... |
|
|
|
|
|
Re: ibatis 3 COUNT -> Booleanhere is the java doc for how the resultset implementation should handle this. As long as your query will only return 0/1 you should be okay. If not, then I would just wrap the count() in an if and return a 1 if count was more than 1.
I would also set both the jdbc type and the return type. jdbcType to NUMBER and Boolean for the Result. Nathan
getBooleanboolean getBoolean(int columnIndex)
throws SQLException
On Wed, Nov 4, 2009 at 12:42 PM, Douglas Bell <DBell@...> wrote: I'm trying to do the following using beta 5 (this was working in beta 3) |
|
|
Re: ibatis 3 petstoreI started on one but got pulled away with real life :) Guess I need a vacation to get some free time to code :) Man that sounds like hell.
On Wed, Nov 4, 2009 at 11:45 AM, a b <eodnohj@...> wrote: Is there a sample application written in ibatis 3 and spring such as petstore? |
| Free embeddable forum powered by Nabble | Forum Help |