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 Vi...@hud.gov on 2006/12/12 22:05:11 UTC

usage of namespace

To all,

In IBATIS documentation I cannot see any usage of namespace (global 
setting in sql-map-config,xml and references in 
<sqlMap namespace="xxxxxx"> portion of xml files included in 
sql-map-config,xml  ).

Please send me example of code.

Re: usage of namespace

Posted by Larry Meadors <lm...@apache.org>.
Basically, it works like a package in java, or namespaces in C#.

If you have a mapped statement named "insert" with a namespace of
"department", you call it using the name "department.insert".

So, why do that instead of insertDepartment? Well, it makes things
lots easier if you want to make smarter dao classes that know that you
always use "insert" to insert an object, and if you pass a Department
object, it can figure that part out, too.

It's also real nice organizationally, if you name the xml file to
match the namespace - then you know exactly where to find
"department.insert", too.

Larry


On 12/12/06, Viktor_X._Kopit@hud.gov <Vi...@hud.gov> wrote:
>
> To all,
>
> In IBATIS documentation I cannot see any usage of namespace (global setting
> in sql-map-config,xml and references in
> <sqlMap namespace="xxxxxx"> portion of xml files included in
> sql-map-config,xml  ).
>
> Please send me example of code.