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 joyukiok <jo...@gmail.com> on 2008/11/13 01:46:51 UTC

Dynamically generate ibatis sql maps at startup

I have an application that uses ibatis to persist data by calling a stored
procedure. This is achieved using ibatis combined with its Spring support.
I’m now looking to expand this application and add multiple stored procedure
(>100). A different stored procedure will be called based on attributes of
the pojo/object to be persisted.

Therefore, I would prefer if I did not have to create all the sql maps
required to bind my objects to the correct stored procedure. Instead I would
prefer to lookup the meta data for a list of stored procedure names on
startup. Then in my Data Access Layer, I would be able to retrieve the
relevant stored procedure sql map and dynamically bind to it. The attribute
names on the pojo/object would match the input parameters of the stored
procedure.

Does ibatis provide the ability to do what I’ve outlined above? Does it have
the ability to build sql maps on startup which can be referenced later?

Thanking you in advance.

-- 
View this message in context: http://www.nabble.com/Dynamically-generate-ibatis-sql-maps-at-startup-tp20472794p20472794.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


RE: Dynamically generate ibatis sql maps at startup

Posted by "Young, Alistair" <al...@logica.com>.
This would be a very useful feature.

I've done something a bit like this in the past by, essentially,
generating the necessary XML at runtime when the application starts up.
It's not very elegant, but it works.


Alistair.

-----Original Message-----
From: joyukiok [mailto:joyukiok@gmail.com] 
Sent: 13 November 2008 00:47
To: user-java@ibatis.apache.org
Subject: Dynamically generate ibatis sql maps at startup


I have an application that uses ibatis to persist data by calling a
stored procedure. This is achieved using ibatis combined with its Spring
support.
I'm now looking to expand this application and add multiple stored
procedure (>100). A different stored procedure will be called based on
attributes of the pojo/object to be persisted.

Therefore, I would prefer if I did not have to create all the sql maps
required to bind my objects to the correct stored procedure. Instead I
would prefer to lookup the meta data for a list of stored procedure
names on startup. Then in my Data Access Layer, I would be able to
retrieve the relevant stored procedure sql map and dynamically bind to
it. The attribute names on the pojo/object would match the input
parameters of the stored procedure.

Does ibatis provide the ability to do what I've outlined above? Does it
have the ability to build sql maps on startup which can be referenced
later?

Thanking you in advance.

--
View this message in context:
http://www.nabble.com/Dynamically-generate-ibatis-sql-maps-at-startup-tp
20472794p20472794.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.



This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you.