You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by "pieter.baele@pandora.be" <pi...@telenet.be> on 2008/03/02 20:09:18 UTC

iBATIS for swing application

Hello,

I am a student (college university) working on a part of a fictive project management software system.

We received a database dll scheme, so Hibernate was not really an option. It's also a very short project (8 weeks) so iBATIS is definitely a better solution.
(shorter learning curve)

I've bought iBATIS in action and generated Java Beans and sqlmaps with abator.

But now I am stuck. I need some sort of Factory/Facade/Controller for the sqlMaps, but how to code these? 
It's a desktop app, so isn't the (Spring) DAO overkill??? (I also don't have enough time...)
Is it necessary to use a DAO? Is the iBATIS DAO out-of-date because it isn't under development anymore?

I don't like the MVC solution we've seen in the Java lessons - manually writing a Connection class, and Mapper classes (Prepared and Callable statements)
...but I also don't really know how to fill in the gap between Swing (view) and the sqlmaps + beans... 

Any help is greatly appreciated.

A desperate ;-) student
Greeting, PieterB





Re: iBATIS for swing application

Posted by Pieter Baele <pi...@telenet.be>.
I did want to use Spring for its power and nice features, but there is  
not enough time.
It's just 6 to 8 iterations of one week... and now we are in our third  
iteration.
So it's too much overhead for this 'college' project.

I've planned to start using Spring on my own - altogether with  
iBATIS ;-)

Yours faithfully,
Pieter Baele
pieter.baele@telenet.be


On 04 Mar 2008, at 03:09, Jason Kratz wrote:

> I’d have to agree. I’m not sure how using Spring DAO would be any  
> more overkill than iBATIS itself.  It actually isn’t adding that  
> much over the top.  Far as time goes getting your application to use  
> Spring is minimal.  It just isn’t that hard.    Maybe you don’t have  
> a need for any of the other services but if you do then you should  
> use it.  You get a lot of power there.
>
> Jason
>
> From: Ryan Shelley [mailto:12gaugemedia@gmail.com]
> Sent: Monday, March 03, 2008 6:56 PM
> To: user-java@ibatis.apache.org
> Subject: Re: iBATIS for swing application
>
> This is outside the scope of the iBATIS discussion, but why wouldn't  
> you consider using Spring for your application?  I've written  
> several non-web-based apps using Spring and can say it simplified  
> the development and configuration of the app, plus, it gives you  
> intrinsic access to a ton of resources, such as iBATIS, out-of-the- 
> box.  Unless you've already started heavy development without  
> Spring, it wouldn't be a terrible effort to add it.
>
> -Ryan
> On Sun, Mar 2, 2008 at 11:09 AM, pieter.baele@pandora.be <pieter.baele@telenet.be 
> > wrote:
> Hello,
>
> I am a student (college university) working on a part of a fictive  
> project management software system.
>
> We received a database dll scheme, so Hibernate was not really an  
> option. It's also a very short project (8 weeks) so iBATIS is  
> definitely a better solution.
> (shorter learning curve)
>
> I've bought iBATIS in action and generated Java Beans and sqlmaps  
> with abator.
>
> But now I am stuck. I need some sort of Factory/Facade/Controller  
> for the sqlMaps, but how to code these?
> It's a desktop app, so isn't the (Spring) DAO overkill??? (I also  
> don't have enough time...)
> Is it necessary to use a DAO? Is the iBATIS DAO out-of-date because  
> it isn't under development anymore?
>
> I don't like the MVC solution we've seen in the Java lessons -  
> manually writing a Connection class, and Mapper classes (Prepared  
> and Callable statements)
> ...but I also don't really know how to fill in the gap between Swing  
> (view) and the sqlmaps + beans...
>
> Any help is greatly appreciated.
>
> A desperate ;-) student
> Greeting, PieterB
>
>
>
>


RE: iBATIS for swing application

Posted by Jason Kratz <ja...@firm58.com>.
I'd have to agree. I'm not sure how using Spring DAO would be any more
overkill than iBATIS itself.  It actually isn't adding that much over the
top.  Far as time goes getting your application to use Spring is minimal.
It just isn't that hard.    Maybe you don't have a need for any of the other
services but if you do then you should use it.  You get a lot of power
there.

 

Jason

 

From: Ryan Shelley [mailto:12gaugemedia@gmail.com] 
Sent: Monday, March 03, 2008 6:56 PM
To: user-java@ibatis.apache.org
Subject: Re: iBATIS for swing application

 

This is outside the scope of the iBATIS discussion, but why wouldn't you
consider using Spring for your application?  I've written several
non-web-based apps using Spring and can say it simplified the development
and configuration of the app, plus, it gives you intrinsic access to a ton
of resources, such as iBATIS, out-of-the-box.  Unless you've already started
heavy development without Spring, it wouldn't be a terrible effort to add
it.

-Ryan

On Sun, Mar 2, 2008 at 11:09 AM, pieter.baele@pandora.be
<pi...@telenet.be> wrote:

Hello,

I am a student (college university) working on a part of a fictive project
management software system.

We received a database dll scheme, so Hibernate was not really an option.
It's also a very short project (8 weeks) so iBATIS is definitely a better
solution.
(shorter learning curve)

I've bought iBATIS in action and generated Java Beans and sqlmaps with
abator.

But now I am stuck. I need some sort of Factory/Facade/Controller for the
sqlMaps, but how to code these?
It's a desktop app, so isn't the (Spring) DAO overkill??? (I also don't have
enough time...)
Is it necessary to use a DAO? Is the iBATIS DAO out-of-date because it isn't
under development anymore?

I don't like the MVC solution we've seen in the Java lessons - manually
writing a Connection class, and Mapper classes (Prepared and Callable
statements)
...but I also don't really know how to fill in the gap between Swing (view)
and the sqlmaps + beans...

Any help is greatly appreciated.

A desperate ;-) student
Greeting, PieterB





 


Re: iBATIS for swing application

Posted by Ryan Shelley <12...@gmail.com>.
This is outside the scope of the iBATIS discussion, but why wouldn't you
consider using Spring for your application?  I've written several
non-web-based apps using Spring and can say it simplified the development
and configuration of the app, plus, it gives you intrinsic access to a ton
of resources, such as iBATIS, out-of-the-box.  Unless you've already started
heavy development without Spring, it wouldn't be a terrible effort to add
it.

-Ryan

On Sun, Mar 2, 2008 at 11:09 AM, pieter.baele@pandora.be <
pieter.baele@telenet.be> wrote:

> Hello,
>
> I am a student (college university) working on a part of a fictive project
> management software system.
>
> We received a database dll scheme, so Hibernate was not really an option.
> It's also a very short project (8 weeks) so iBATIS is definitely a better
> solution.
> (shorter learning curve)
>
> I've bought iBATIS in action and generated Java Beans and sqlmaps with
> abator.
>
> But now I am stuck. I need some sort of Factory/Facade/Controller for the
> sqlMaps, but how to code these?
> It's a desktop app, so isn't the (Spring) DAO overkill??? (I also don't
> have enough time...)
> Is it necessary to use a DAO? Is the iBATIS DAO out-of-date because it
> isn't under development anymore?
>
> I don't like the MVC solution we've seen in the Java lessons - manually
> writing a Connection class, and Mapper classes (Prepared and Callable
> statements)
> ...but I also don't really know how to fill in the gap between Swing
> (view) and the sqlmaps + beans...
>
> Any help is greatly appreciated.
>
> A desperate ;-) student
> Greeting, PieterB
>
>
>
>
>

Re: iBATIS for swing application

Posted by Jeff Butler <je...@gmail.com>.
Here's a way to use the generic DAOs built by Abator (I think this is the
easiest way to do it if you're not using Spring):

1. Use Abator to generate generic DAOs with the GENERIC-CI DAO generator
2. Write an SqlMapConfig.xml file listing all the SqlMap.xml files generated
by Abator (theres an example in the Abator documentation)
3. Write a Singleton factory for DAOs the DAOs:

public class DAOFactory {

  private static DAOFactory instance = new DAOFactory();
  public static DAOFactory getInstance() {
    return instance;
  }

  private SqlMapClient sqlMap;
  private MyDao myDao;

  private DAOFactory () {
    String resource = "com/mycompany/SqlMapConfig.xml";
    Reader reader = Resources.getResourceAsReader(resource);
    sqlMap = SqlMapClientBuilder.buildSqlMap(reader);
  }

  public MyDao getMyDao() {
    if (myDao == null) {
      myDao = new MyDaoImpl(sqlMap);
    }
    return myDao;
  }
}

You can repeat the MyDao method for every DAO generated by Abator.

3. Use this factory anywhere in your Swing app like this:

MyDao myDao = DAOFactory.getInstance().getMyDao();
myDao.insert(myObject);

etc.

Hope that helps -

Jeff Butler






On Sun, Mar 2, 2008 at 1:09 PM, pieter.baele@pandora.be <
pieter.baele@telenet.be> wrote:

> Hello,
>
> I am a student (college university) working on a part of a fictive project
> management software system.
>
> We received a database dll scheme, so Hibernate was not really an option.
> It's also a very short project (8 weeks) so iBATIS is definitely a better
> solution.
> (shorter learning curve)
>
> I've bought iBATIS in action and generated Java Beans and sqlmaps with
> abator.
>
> But now I am stuck. I need some sort of Factory/Facade/Controller for the
> sqlMaps, but how to code these?
> It's a desktop app, so isn't the (Spring) DAO overkill??? (I also don't
> have enough time...)
> Is it necessary to use a DAO? Is the iBATIS DAO out-of-date because it
> isn't under development anymore?
>
> I don't like the MVC solution we've seen in the Java lessons - manually
> writing a Connection class, and Mapper classes (Prepared and Callable
> statements)
> ...but I also don't really know how to fill in the gap between Swing
> (view) and the sqlmaps + beans...
>
> Any help is greatly appreciated.
>
> A desperate ;-) student
> Greeting, PieterB
>
>
>
>
>