Hi,
Thank you for your answer.
Your suggestion to enable/disable the log is not usable for us. We are talking about a production system, so the Java log and Oracle log are reduced to a minimum : we log only the error cases. There is no enabling/disabling logging temporarily (beyond the fact that we could have a non repetitive error, like one depending on the number of users and concurrency). So we are interested in a solution which logs a maximum of information in case of error, but which does not slows down the system during normal operation.
The aliases given for the columns are not so unique as you said. Here is an example of a query generated by Hibernate (I've put a comment LOOK HERE for the interesting part):
Code:
select octroicred0_.OCTRCSCIDUUOID as OCTRCSCI1_,
octroicred0_.OCTRCSCIDTYP as OCTRCSCI2_,
decode (octroicred0_.OCTRCSCIDUUOID,octroicred0__1_.OCTRCSCIDUUOID, 1, octroicred0__2_.OCTRCSCIDUUOID, 2,0 ) as clazz_,
octroicred0_.VERSION as VERSION49_,
[b]/* LOOK HERE */
octroicred0_.CTRSUPPORTNUM as CTRSUPPO4_49_,
octroicred0_.CTRSUPPORTTYP as CTRSUPPO5_49_,
octroicred0_.CTRSUPPORTORD as CTRSUPPO6_49_,
octroicred0_.CTRSUPPORTPD as CTRSUPPO7_49_,
octroicred0_.CTRSUPPORTIDXDTL as CTRSUPPO8_49_,
octroicred0_.CTRSUPPORTRIB as CTRSUPPO9_49_, octroicred0_.CTRSUPPORTNUMKRTBQR as CTRSUPP10_49_,
octroicred0_.CTRSUPPORTAGNC as CTRSUPP11_49_,
octroicred0_.CTRSUPPORTBANQ as CTRSUPP12_49_,
octroicred0_.CTRSUPPORTIDTEK as CTRSUPP13_49_, octroicred0_.CTRSUPPORTNUMOPASSU as CTRSUPP14_49_,
octroicred0_.CTRSUPPORTIDTITLRNUMP as CTRSUPP15_49_,
octroicred0_.CTRSUPPORTIDTITLRBANQ as CTRSUPP16_49_, octroicred0_.CTRSUPPORTIDTITLRIDTEK as CTRSUPP17_49_,
/*END LOOK HERE*/[/b]
octroicred0_.ETATCREDICD as ETATCRE18_4
9_, octroicred0_.refDOSSIERNUM as refDOSS19_49_, octroicred0_.re
fDOSSIERORD as refDOSS20_49_, octroicred0_.refDOSSIERPD as refDO
SS21_49_, octroicred0_.refDOSSIERAGNC as refDOSS22_49_, octroicr
ed0_.refDOSSIERBANQ as refDOSS23_49_, octroicred0_.IDPDLABEL as
IDPDLABEL49_, octroicred0_.IDPDISPDAMVT as IDPDISP25_49_, octroi
cred0_.IDPDTYPPDTITRECD as IDPDTYP26_49_, octroicred0_.IDPDCDPD
as IDPDCDPD49_, octroicred0_.IDPDBANQ as IDPDBANQ49_, octroicred
0_.IDPDIDTEK as IDPDIDTEK49_, octroicred0_.IDPDTYPTEK as IDPDTYP
TEK49_, octroicred0_.IDRELCOMCLSSMT as IDRELCO31_49_, octroicred
0_.IDRELCOMBANQ as IDRELCO32_49_, octroicred0_.IDRELCOMAGNC as I
DRELCO33_49_,
octroicred0_.ENTITYVERSIONAN as ENTITYV34_49_,
octroicred0_.ENTITYVERSIONRELEASEDELAN as ENTITYV35_49_,
octroicred0_.ENTITYVERSIONNUMVERSION as ENTITYV36_49_,
octroicred0_.ENTITYVERSIONNUMPATCH as ENTITYV37_49_, octroicred0_.ENTITYVERSIONNUMBASELINEINT as ENTITYV38_49_,
octroicred0_.DATDERNEMAJOURDAT as DATDERN39_49_, octroicred0__1_.ISOPTGESTIONCMPTAUTO as ISOPTGES3_
71_, octroicred0__1_.MOTIFCLOTURECD as MOTIFCLO4_71_, octroicred
0__1_.AGENCECREATNCD as AGENCECR5_71_, octroicred0__1_.OCTRPRETR
EVDO as OCTRPRET6_71_, octroicred0__1_.ACCRISQREVDO as ACCRISQR7
_71_, octroicred0__1_.OFFREREVDO as OFFREREVDO71_, octroicred0__
1_.SITUFINANCREMPDO as SITUFINA9_71_, octroicred0__2_.MOTIFCLOTU
RECD as MOTIFCLO3_75_, octroicred0__2_.PRJDO as PRJDO75_, octroi
cred0__2_.OFFREDO as OFFREDO75_, octroicred0__2_.sFIANCIEREDO as
sFIANCIE6_75_, octroicred0__2_.ACCRISQDO as ACCRISQDO75_, octro
icred0__2_.OCTRPRETDO as OCTRPRETDO75_
from OCTRCSC octroicred0_,
OCTRREV octroicred0__1_,
OCTRCREDICONSO octroicred0__2_ where
octroicred0_.OCTRCSCIDUUOID=octroicred0__1_.OCTRCSCIDUUOID(+) an
d octroicred0_.OCTRCSCIDTYP=octroicred0__1_.OCTRCSCIDTYP(+) and
octroicred0_.OCTRCSCIDUUOID=octroicred0__2_.OCTRCSCIDUUOID(+) an
d octroicred0_.OCTRCSCIDTYP=octroicred0__2_.OCTRCSCIDTYP(+) and
((octroicred0_.IDRELCOMBANQ=:1 )and(octroicred0_.IDRELCOMAGNC=:2
)and(octroicred0_.IDRELCOMCLSSMT=:3 )and(octroicred0_.ETATCREDI
CD<>:4 ))
In this query you can see that if you eliminate the numbered suffix you get a prefix CTRSUPPO which is the same for a lot of columns. It seems to us that Hibernate does not take the whole column name but only the beginning. So, given an error on the CTRSUPPO alias, we are unable to identify the offending column and the Java object. That's way I asked if the alias definition could be done in the mapping file, we could provide a different alias prefix for each column. Or could I tell Hibernate to use the entire column name for the alias ? If not, where should I modify the code to force it to use the whole column name as prefix ?
I agree with you that net.sf.hibernate.SQL catches all the generated SQL.
Thank you,
Florin Cremenescu
Code: