ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <erlend.bjo...@aftenposten.no>
Subject The sqlMap element include another
Date Tue, 27 Mar 2007 14:45:55 GMT
Hi there!

 

In page 15 in the documentation:

 

The <sqlMap> Element

The sqlMap element is used to explicitly include an SQL Map or another SQL Map Configuration
file.

 

What does the last part mean ?

 

I try to do load one "sub" config file from the "master" config file, is that allowed ? I
do something like this:

 

Main sqlMap config file:

 

--

 

<?xml version="1.0" encoding="UTF-8" standalone="no"?>

<!DOCTYPE sqlMapConfig PUBLIC "-//iBATIS.com//DTD SQL Map Config 2.0//EN" "http://ibatis.apache.org/dtd/sql-map-config-2.dtd">

 

<sqlMapConfig>

 

    <sqlMap resource="sql/Queries.xml"/>

 

...

 

--

 

Then in the "sub" config file: Queries.xml:

 

--

 

<?xml version="1.0" encoding="UTF-8" standalone="no"?>

<!DOCTYPE sqlMapConfig PUBLIC "-//iBATIS.com//DTD SQL Map Config 2.0//EN" "http://ibatis.apache.org/dtd/sql-map-config-2.dtd">

 

<sqlMapConfig>

 

    <sqlMap resource="sql/Postplace.xml"/> 

     ...

 

..

 

--

 

<?xml version="1.0" encoding="UTF-8" standalone="no"?>

<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://ibatis.apache.org/dtd/sql-map-2.dtd">

 

<sqlMap namespace="Postplace">

 

    <select id="retrievePostplaces" resultMap="postplaceBeanResult" parameterClass="postplaceBean">

 

--

 

Load just fine, but when I try to run something, it don't find the query I'm asking for in
this line:

 

sqlMap.queryForMap("retrievePlaces", null, "PLACE");

 

or 

 

sqlMap.queryForMap("Postplace.retrievePlaces", null, "PLACE");

 

 

..

 

Caused by: com.ibatis.sqlmap.client.SqlMapException: There is no statement named retrievePlaces
in this SqlMap.

 

 

--

 

So can you include a "sub" config file or not from a "master" config file ? :-) 

 

 

Thanks!

 

Erlend Bjørge

 

 


Mime
View raw message