You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Alan Chandler <al...@chandlerfamily.org.uk> on 2005/08/26 22:37:21 UTC

Anyone used ibatis with tapestry

I am trying to use ibatis to connect my database to my tapestry application.  
However, starting to debug it I have fallen at the first hurdle.

Although putting my sqlMapConfig.xml file on what I thought was the right 
place on the classpath, I fail to even get a Reader to read this file (it 
says it can't find it on the classpath).

I wonder if its related to tapestry - I get my sqlMap for use in queries via a 
static property of a class I can DataMap defined thus

public class DataMap {
	private static final SqlMapClient sqlMap;
	static {
	  try {
	      String resource = 
"uk/org/chandlerfamily/tapestry/sqlmap/famtree/SqlMapConfig.xml";
	      Reader reader = Resources.getResourceAsReader (resource);
	      sqlMap = SqlMapClientBuilder.buildSqlMapClient(reader);
	   } catch (Exception e) {
	      // If you get an error at this point, it doesn?t matter what it was. It 
is going to be
	      // unrecoverable and we will want the app to blow up hard so we are 
aware of the
	      // problem. You should always log such errors and re-throw them in such 
a way that
	      // you can be made immediately aware of the problem.
	      e.printStackTrace();
	      throw new RuntimeException ("Error initializing DataMap class. Cause: " 
+ e);
	   }
	}
	public static SqlMapClient getSqlMapInstance () {
	  return sqlMap;
	}

}

so once set for this application it should be available from the class 
anywhere.  Can I do it like this, or do I NEED an application state object?


If there is anyone on this list that uses ibatis and could show me the code 
snippets of how to get the map object set up and then read in for each page, 
I would be grateful.


-- 
Alan Chandler
http://www.chandlerfamily.org.uk

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: Anyone used ibatis with tapestry

Posted by Koka <22...@gmail.com>.
Well I've successfully set up test application using
Tap4-Spring-iBatis (pretty sure I could have dropped  Spring and used
HiveMind but... maybe another day, when there'll be some kind of
'HiveMind in Action' tutorial).

I do  not need any kind of ASO for iBatis objects as I just configure
tham in Spring's applicationContext.xml and inject them through
annotations like

    @InjectObject ("spring:transactionManager") 
    public abstract DataSourceTransactionManager getTransactionManager(); 

or 

    @InjectObject ("spring:objectDao") 
    public abstract ObjectDaoImpl getObjectDao();

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: Anyone used ibatis with tapestry

Posted by Alan Chandler <al...@chandlerfamily.org.uk>.
On Saturday 27 Aug 2005 01:02, Ron Piterman wrote:
> ציטוט Alan Chandler:
> I Guess this depend on which version of Tapestry you use.
> If you use 4.0 you should get accuainted with hivemind and use it to
> manage your connection/session bean.

I am using tap4 - and am trying to see if I need to use an ASO (via defining 
it in hivemodule.xml).  However, that is not quite the problem I wanted 
solving - what I really want to understand is do I need to have a 
connection/session bean - since I can create a sqlmap object that is the same 
for the whole application.  There are no changing data values I need to store 
once it has been created.




>
> PS - in "The Server Side" there is a great article which demonstrate how
> this is done with Hibernate. 

Looked - couldn't find it in the first brief foray.  Will look again

> Also on sourceforge there is a Hivemind 
> utils (?) project which delivers the necessary framework to get going...
>

Took a brief look at this - but I think it had some problems with 
incompatibility with annotations or something (can't remember exactly - this 
just seemed an extra layer  of stuff I didn't really need - so didn't follow 
up on it).


-- 
Alan Chandler
http://www.chandlerfamily.org.uk

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: Anyone used ibatis with tapestry

Posted by Ron Piterman <rp...@gmx.net>.
ציטוט Alan Chandler:
> On Friday 26 Aug 2005 21:37, Alan Chandler wrote:
> 
>>I am trying to use ibatis to connect my database to my tapestry
>>application. However, starting to debug it I have fallen at the first
>>hurdle.
> 
> 
> I found the first hurdle problem (typo in the naming).  But I would still like 
> the question of whether I need a ASO discussed

I Guess this depend on which version of Tapestry you use.
If you use 4.0 you should get accuainted with hivemind and use it to 
manage your connection/session bean.
Cheers,
Ron

PS - in "The Server Side" there is a great article which demonstrate how 
this is done with Hibernate. Also on sourceforge there is a Hivemind 
utils (?) project which delivers the necessary framework to get going...


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: Anyone used ibatis with tapestry

Posted by Alan Chandler <al...@chandlerfamily.org.uk>.
On Friday 26 Aug 2005 21:37, Alan Chandler wrote:
> I am trying to use ibatis to connect my database to my tapestry
> application. However, starting to debug it I have fallen at the first
> hurdle.

I found the first hurdle problem (typo in the naming).  But I would still like 
the question of whether I need a ASO discussed
-- 
Alan Chandler
http://www.chandlerfamily.org.uk

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org