1) I want to change my SQL without hard-code. Use XML file will be convenient.
2) Example :
I identify a SQL Map XML files to be loaded by this SQL map in
sql-map-config.xml :
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "
http://www.springframework.org/dtd/spring-beans.dtd">
<sqlMapConfig>
<sqlMap resource="Dept.xml" />
</sqlMapConfig>
This is file
Dept.xml :
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "
http://www.springframework.org/dtd/spring-beans.dtd">
<sqlMap>
<resultMap id="dept" class="com.Model.Dept" >
<result property="deptno"/>
<result property="dname"/>
<result property="loc"/>
</resultMap>
<select id="selectDept" parameterClass="com.Bean.Dept" resultMap="dept">
select deptno,
dname,
loc
from dept
</select>
<insert id="insertDept" parameterClass="com.Bean.Dept">
insert into dept(deptno, dname, loc)
values(#deptno#, #dname#, #loc#)
</insert>
</sqlMap>
Im using Maven with Struts 2 Basic framework. How to cofigure hibernate plugin to execute SQL from Dept.xml??
mraible wrote:
Can you explain 1) why you want to do this and 2) what your XML looks like?
Matt
On Wed, Apr 15, 2009 at 8:14 PM, Kenny Ha <vifaxocker@yahoo.com> wrote:
>
> Hi all,
>
> Im developing Maven with Struts 2 Basic framework.
> I want hibernate to execute SQL (select,insert,update,delete) which is
> defined from XML file (like Maven with Spring framework) not from code
>
> How can I do that? Please help me
> Thanks all!
> --
> View this message in context:
>
http://www.nabble.com/Execute-SQL-defined-from-XML-tp23070294s2369p23070294.html> Sent from the AppFuse - Dev mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@appfuse.dev.java.net
> For additional commands, e-mail: dev-help@appfuse.dev.java.net
>
>