Hi,
I have a problem with this statement : I use a dynamic query to build the
list of fields to retreive (BOOKDATA, BDIDATA,OTHERDATA are large data BLOB
so i dont want to retreive them every time).
<select id="ExtractPnlBetweenTwoDates" parameterClass
="PnlXmlCacheTwoDatesEntity" resultClas="PnlXmlCacheEntity">
SELECT ID, ITEM, REPORTDATE, CURRENCY, MARKETDATASOURCE, VALIDATED,
CREATION
<dynamic>
<isEqual property="ExtractBookData" compareValue="true" prepend
=",">
BOOKDATA
</isEqual>
<isEqual property="ExtractBdiData" compareValue="true" prepend
=",">
BDIDATA
</isEqual>
<isEqual property="ExtractOtherData" compareValue="true"
prepend=",">
OTHERDATA
</isEqual>
</dynamic>
FROM PNL_XMLCACHE
</select>
I executed it with all properties of the parameterClass (ExtractBookData,
ExtractBookData, ExtractOtherData) set to true : it worked propoerly. I
executed it a second time, with all properties of the parameterClass set to
false, and the error below occured :
Primo.Application: Cannot extract Pnl Xml Data
System.IndexOutOfRangeException: OTHERDATA
at System.Data.OracleClient.FieldNameLookup.GetOrdinal(String fieldName)
at System.Data.OracleClient.OracleDataReader.GetOrdinal(String name)
at
IBatisNet.DataMapper.TypeHandlers.ByteArrayTypeHandler.GetValueByName(ResultProperty
mapping, IDataReader dataReader)
at
IBatisNet.DataMapper.Configuration.ResultMapping.ResultProperty.GetDataBaseValue(IDataReader
dataReader)
at
IBatisNet.DataMapper.MappedStatements.ReaderAutoMapper.AutoMapReader(IDataReader
reader, Object& resultObject)
at
IBatisNet.DataMapper.MappedStatements.MappedStatement.AutoMapReader(IDataReader
reader, Object& resultObject)
at
IBatisNet.DataMapper.MappedStatements.MappedStatement.ApplyResultMap(RequestScope
request, IDataReader reader, Object resultObject)
at
IBatisNet.DataMapper.MappedStatements.MappedStatement.RunQueryForList(RequestScope
request, IDalSession session, Object parameterObject, Int32 skipResults,
Int32 maxResults, RowDelegate rowDelegate)
at
IBatisNet.DataMapper.MappedStatements.MappedStatement.ExecuteQueryForList(IDalSession
session, Object parameterObject, Int32 skipResults, Int32 maxResults)
at
IBatisNet.DataMapper.MappedStatements.MappedStatement.ExecuteQueryForList(IDalSession
session, Object parameterObject)
at IBatisNet.DataMapper.SqlMapper.QueryForList(String statementName,
Object parameterObject)
at
Primo.ReportingServices.PnlXmlCache.PnlXmlCacheManager.SelectData(String[]
items, DateTime dateFrom, DateTime dateTo, String currency, String
marketDataSource, Boolean validatedOnly, EDataExtract
choiceExtractBetweenTwoDates)
Of course, I checked SQL statements are generated properly. By looking at
the source code, it guess the guilty is the object ReaderAutoMapper . (I
assume this object act as a simple resultmap that map sql fields to
resultClass properties with the same name) It seems cached for each
statement. so the first one, created with all fields , is used the second
time => Exception : OTHERDATA was not retrieved
So, Am I right with my supposition ? Can we consider it as a bug ?
Is there a more smart solution to achieve what I want to do ?
Thanks And Regards
Nicolas
PS : I use version from SVN get on september 2nd
This message and any attachments (the "message") is
intended solely for the addressees and is confidential.
If you receive this message in error, please delete it and
immediately notify the sender. Any use not in accord with
its purpose, any dissemination or disclosure, either whole
or partial, is prohibited except formal approval. The internet
can not guarantee the integrity of this message.
BNP PARIBAS (and its subsidiaries) shall (will) not
therefore be liable for the message if modified.
---------------------------------------------
Ce message et toutes les pieces jointes (ci-apres le
"message") sont etablis a l'intention exclusive de ses
destinataires et sont confidentiels. Si vous recevez ce
message par erreur, merci de le detruire et d'en avertir
immediatement l'expediteur. Toute utilisation de ce
message non conforme a sa destination, toute diffusion
ou toute publication, totale ou partielle, est interdite, sauf
autorisation expresse. L'internet ne permettant pas
d'assurer l'integrite de ce message, BNP PARIBAS (et ses
filiales) decline(nt) toute responsabilite au titre de ce
message, dans l'hypothese ou il aurait ete modifie.