Dashboard > iBATIS DataMapper > Home > 3rd Party Contributions
3rd Party Contributions
Added by Brandon Goodin, last edited by Larry Meadors on Oct 04, 2007  (view change)
Labels: 
(None)


IDEA plug-in by Libing Chen and Larry Meadors

Libing Chen started this plug-in and we've been doing some more work on it.

We have more plans to expand it, but it already has (reasonably) intelligent SQL generation for CRUD operations, as well as a few other feature that we haven't gotten documented yet.

Learn more about it here.

SQL Map Generator by Alex Egorov

Alex has created some handy scripts to generate all of your SQL Maps and configuration. If you're looking to jumpstart your development with iBATIS, this is a good tool to try. The website is a bit slow, but it's a lot faster than coding by hand.

http://alxeg.narod.ru/ibatis/index.html

Jasmine IDE IBatis GUI

Well I've taken a crack at a point and click program for building maps/ value objects and a dao class (not ibatis dao just a java class to invoke an sqlclient's methods). It allows you to set up a project and specify a db connection along with all the usual config stuff. (You need to set up your db connections first. Make sure that your driver and all jars are on the system classpath)

It shows all the tables in your selected connection which you use to build your objects and maps by pointing and clicking. Create a new Value object and double click a table and then double click columns. It's a bit like ms access query builder with the addition of fields for java type, java name etc.. It also writes the config file and updates the map references as you create new maps. Also a util class with a single static method which creates the Reader and reads the config and returns the SQLMapsClient. You can daisy chain maps together by adding list (called "Complex properties" on the UI) properties to your java value object and specifying the map to fetch them.

I've used it on 2 small projects so far and it seems to save a lot of work. There are a few pain in the neck things that I need to sort out but it works ok. Mainly it always rewrites all 3 files when you reopen you value object in the GUI. So if you've tweaked them your changes get overwritten. If you bear that in mind it seems fairly useful. Once you get everything set up you just tweak things outside the UI. Sorry there is no documentation at all.

Maybe this thing will actually help somebody out.

It's included in JasmineIDE as a plugin.

http://sourceforge.net/projects/jasmineide
http://jasmineide.sourceforge.net

Convert ResultSet to JSTL Result

Note

I'm updating this just to fix some errors in the Wiki page that have cropped-up in the 14+ months since I originally posted this. I haven't been following iBATIS lately (not by choice) so I'm not sure if this is still correct or useful.

This is the version I've currently got in my personal repo. It makes use of two classes that I'm not including: com.dotech.servlet.jstl.ResultSupport and com.dotech.sql.SqlHelper. For ResultSupport, simply replace it with javax.servlet.jsp.jstl.sql.ResultSupport. It should be pretty obvious that SqlHelper is just a utility class to help with JDBC stuff, so just replace it with whatever you would normally use.

This was posted to gmane.comp.java.ibatisdb.user (although the attachment didn't seem to make it into the thread), but I thought it might be convenient to dump it here as well: ResultSetToResultHandler.java

Here's a simple config (it's also an example of using an Oracle cursor as an OUT parameter for a stored procedure):

<sqlMapConfig>

    <typeAlias alias="result"
               type="javax.servlet.jsp.jstl.sql.Result"/>

    <typeAlias alias="cursorHandler"
               type="com.dotech.ibatis.ResultSetToResultHandler"/>

    <typeHandler javaType="result"
                 jdbcType="ORACLECURSOR"
                 callback="cursorHandler"/>
</sqlMapConfig>
<sqlMap>

    <parameterMap id="noInputsSingleResult" class="map">
        <parameter property="resultCode"
                   javaType="int"
                   jdbcType="NUMERIC"
                   nullValue="-1"
                   mode="OUT"/>
        <parameter property="result"
                   javaType="result"
                   jdbcType="ORACLECURSOR"
                   mode="OUT"/>
    </parameterMap>

    <procedure id="getFunds" parameterMap="noInputsSingleResult">
        {?= call get_funds(?)}
    </procedure>

</sqlMap>
SqlMapExecutor exec = ...;
Map params = new HashMap(2);
exec.queryForObject("getFunds", params);
Integer resultCode = (Integer)params.get("resultCode");
if (resultCode == null) {
    // error
} else {
    int resultCodeValue = resultCode.intValue();
    if (resultCodeValue == 0) {
        Result result = (Result)params.get("result");
        // process
    } else {
        // error
    }
}

Although this solution relies on JSTL classes, it is not limited to Servlet/JSP or J2EE applications, nor does it require the use of other JSTL features. The javax.servlet.jsp.jstl.sql.Result interface (API) and the javax.servlet.jsp.jstl.sql.ResultSupport class (API) only depend on J2SE. In other words, this solution will work for pretty much any Java application.

An implementation of JSTL is provided by Apache's Jakarta Standard Taglib Project. Please note that if you do want to use the other features of JSTL in a web application, the provided link is for a version of the Standard taglib that is compatible with JSP 2.0. A version that is compatible with JSP 1.2 can be found here. No matter which version you choose, the classes will be located in the jstl.jar file that is included in the distribution.

Java model object creation through Velocity's templates

This implementation of JavaModelGenerator allows class creation through Velocity's templates.

advantage:

  • templates are externals to Java code
  • easy to modify existing methods of created classes
  • easy to add extra methods of created classes (for example equals,hashCode, toString ...)
  • allows personalization of single created class

disadvantage:

  • Velocity know-how ( it's easy )

More info in my WEB space

IDEA_PLUG_IN (iBATIS DataMapper)
New Page (iBATIS DataMapper)

IBatisNetGen – CodeSmith template for IBatis.NET

http://www.cnblogs.com/smartkid/archive/2007/02/22/653828.html

iBATIS Plugin for IntelliJ IDEA, please reference http://code.google.com/p/ibatis-plugin

Site running on a free Atlassian Confluence Open Source Project License granted to OSS. Evaluate Confluence today.
Powered by Atlassian Confluence, the Enterprise Wiki. (Version: 2.5.5 Build:#811 Jul 25, 2007) - Bug/feature request - Contact Administrators