ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Amit Kushwaha <blue...@googlemail.com>
Subject Inline parameter map - default values
Date Tue, 13 Feb 2007 02:49:28 GMT
Hi,

How do you specify default values for inline parameter maps -

For example, in the following insert snippet that maps a Product domain 
to a PRODUCT table,
the 3 values (id, description and price) for PRODUCT come from 
attribute's of the Product domain class,

<insert id=”statementName” parameterClass=” examples.domain.Product”>
insert into PRODUCT values (#id#, #description#, #price#)
</insert>

Lets say if the PRODUCT table also needs an APP_CODE, UPDATED_BY and 
UPDATED_DATE non nullable fields. And the Product class
does not contain these as attributes.

Is there an easy way to make it work, may be, by specifying,

<insert id=”statementName” parameterClass=” examples.domain.Product”>
insert into PRODUCT values (#id#, #description#, #price#, '3', 'XYZ', 
SYSDATE)
</insert>

I know, we could pass a Map instead, but that would mean extracting the 
domain values from Product and putting them into a Map in code. Correct?
As this could be a bit tedious for a domain class containing lot's of 
attributes.

Actually I need to map to quite a few stored procs. There are defaults 
to be passed to the proc, nested beans and lots of attributes, so the 
need for something concise.

TIA.

Regards,

Amit

Mime
View raw message