Hibernate version:
2.1.6
Mapping documents:
<class name="TwentyFieldsDfnImpl" table="twenty_fields_dfn" lazy="true" >
<id name="TfdId" type="int" column="tfd_id" unsaved-value="0" >
<generator class="assigned" />
</id>
<version name="VersionId" column="tfd_version_id" type="int" />
<property name="DeleteFl" column="tfd_delete_fl" type="yes_no" not-null="true" />
<property name="PartitionId" column="ptn_id" type="int" not-null="true" />
<property name="PatId" column="pat_id" type="int" not-null="true" />
<property name="TfdArgCount" column="tfd_arg_count" type="int" not-null="true" />
<property name="TfdArg1Name" column="tfd_arg1_name" type="com.xxx.database.hibernate.type.StringType" not-null="false" />
<property name="TfdArg1MandatoryFl" column="tfd_arg1_mandatory_fl" type="yes_no" not-null="true" />
<property name="TfdArg1Datatype" column="tfd_arg1_datatype" type="com.xxx.database.hibernate.type.StringType" not-null="false" />
<property name="TfdArg1SearchType" column="tfd_arg1_search_type" type="com.xxx.database.hibernate.type.StringType" not-null="false" />
<property name="TfdArg2Name" column="tfd_arg2_name" type="com.xxx.database.hibernate.type.StringType" not-null="false" />
<property name="TfdArg2MandatoryFl" column="tfd_arg2_mandatory_fl" type="yes_no" not-null="true" />
<property name="TfdArg2Datatype" column="tfd_arg2_datatype" type="com.xxx.database.hibernate.type.StringType" not-null="false" />
<property name="TfdArg2SearchType" column="tfd_arg2_search_type" type="com.xxx.database.hibernate.type.StringType" not-null="false" />
<property name="TfdArg3Name" column="tfd_arg3_name" type="com.xxx.database.hibernate.type.StringType" not-null="false" />
<property name="TfdArg3MandatoryFl" column="tfd_arg3_mandatory_fl" type="yes_no" not-null="true" />
<property name="TfdArg3Datatype" column="tfd_arg3_datatype" type="com.xxx.database.hibernate.type.StringType" not-null="false" />
<property name="TfdArg3SearchType" column="tfd_arg3_search_type" type="com.xxx.database.hibernate.type.StringType" not-null="false" />
<property name="TfdArg4Name" column="tfd_arg4_name" type="com.xxx.database.hibernate.type.StringType" not-null="false" />
<property name="TfdArg4MandatoryFl" column="tfd_arg4_mandatory_fl" type="yes_no" not-null="true" />
<property name="TfdArg4Datatype" column="tfd_arg4_datatype" type="com.xxx.database.hibernate.type.StringType" not-null="false" />
<property name="TfdArg4SearchType" column="tfd_arg4_search_type" type="com.xxx.database.hibernate.type.StringType" not-null="false" />
<property name="TfdArg5Name" column="tfd_arg5_name" type="com.xxx.database.hibernate.type.StringType" not-null="false" />
<property name="TfdArg5MandatoryFl" column="tfd_arg5_mandatory_fl" type="yes_no" not-null="true" />
<property name="TfdArg5Datatype" column="tfd_arg5_datatype" type="com.xxx.database.hibernate.type.StringType" not-null="false" />
<property name="TfdArg5SearchType" column="tfd_arg5_search_type" type="com.xxx.database.hibernate.type.StringType" not-null="false" />
<property name="TfdArg6Name" column="tfd_arg6_name" type="com.xxx.database.hibernate.type.StringType" not-null="false" />
<property name="TfdArg6MandatoryFl" column="tfd_arg6_mandatory_fl" type="yes_no" not-null="true" />
<property name="TfdArg6Datatype" column="tfd_arg6_datatype" type="com.xxx.database.hibernate.type.StringType" not-null="false" />
<property name="TfdArg6SearchType" column="tfd_arg6_search_type" type="com.xxx.database.hibernate.type.StringType" not-null="false" />
<property name="TfdArg7Name" column="tfd_arg7_name" type="com.xxx.database.hibernate.type.StringType" not-null="false" />
<property name="TfdArg7MandatoryFl" column="tfd_arg7_mandatory_fl" type="yes_no" not-null="true" />
<property name="TfdArg7Datatype" column="tfd_arg7_datatype" type="com.xxx.database.hibernate.type.StringType" not-null="false" />
<property name="TfdArg7SearchType" column="tfd_arg7_search_type" type="com.xxx.database.hibernate.type.StringType" not-null="false" />
<property name="TfdArg8Name" column="tfd_arg8_name" type="com.xxx.database.hibernate.type.StringType" not-null="false" />
<property name="TfdArg8MandatoryFl" column="tfd_arg8_mandatory_fl" type="yes_no" not-null="true" />
<property name="TfdArg8Datatype" column="tfd_arg8_datatype" type="com.xxx.database.hibernate.type.StringType" not-null="false" />
<property name="TfdArg8SearchType" column="tfd_arg8_search_type" type="com.xxx.database.hibernate.type.StringType" not-null="false" />
<property name="TfdArg9Name" column="tfd_arg9_name" type="com.xxx.database.hibernate.type.StringType" not-null="false" />
<property name="TfdArg9MandatoryFl" column="tfd_arg9_mandatory_fl" type="yes_no" not-null="true" />
<property name="TfdArg9Datatype" column="tfd_arg9_datatype" type="com.xxx.database.hibernate.type.StringType" not-null="false" />
<property name="TfdArg9SearchType" column="tfd_arg9_search_type" type="com.xxx.database.hibernate.type.StringType" not-null="false" />
<property name="TfdArg10Name" column="tfd_arg10_name" type="com.xxx.database.hibernate.type.StringType" not-null="false" />
<property name="TfdArg10MandatoryFl" column="tfd_arg10_mandatory_fl" type="yes_no" not-null="true" />
<property name="TfdArg10Datatype" column="tfd_arg10_datatype" type="com.xxx.database.hibernate.type.StringType" not-null="false" />
<property name="TfdArg10SearchType" column="tfd_arg10_search_type" type="com.xxx.database.hibernate.type.StringType" not-null="false" />
<property name="TfdArg11Name" column="tfd_arg11_name" type="com.xxx.database.hibernate.type.StringType" not-null="false" />
<property name="TfdArg11MandatoryFl" column="tfd_arg11_mandatory_fl" type="yes_no" not-null="true" />
<property name="TfdArg11Datatype" column="tfd_arg11_datatype" type="com.xxx.database.hibernate.type.StringType" not-null="false" />
<property name="TfdArg11SearchType" column="tfd_arg11_search_type" type="com.xxx.database.hibernate.type.StringType" not-null="false" />
<property name="TfdArg12Name" column="tfd_arg12_name" type="com.xxx.database.hibernate.type.StringType" not-null="false" />
<property name="TfdArg12MandatoryFl" column="tfd_arg12_mandatory_fl" type="yes_no" not-null="true" />
<property name="TfdArg12Datatype" column="tfd_arg12_datatype" type="com.xxx.database.hibernate.type.StringType" not-null="false" />
<property name="TfdArg12SearchType" column="tfd_arg12_search_type" type="com.xxx.database.hibernate.type.StringType" not-null="false" />
<property name="TfdArg13Name" column="tfd_arg13_name" type="com.xxx.database.hibernate.type.StringType" not-null="false" />
<property name="TfdArg13MandatoryFl" column="tfd_arg13_mandatory_fl" type="yes_no" not-null="true" />
<property name="TfdArg13Datatype" column="tfd_arg13_datatype" type="com.xxx.database.hibernate.type.StringType" not-null="false" />
<property name="TfdArg13SearchType" column="tfd_arg13_search_type" type="com.xxx.database.hibernate.type.StringType" not-null="false" />
<property name="TfdArg14Name" column="tfd_arg14_name" type="com.xxx.database.hibernate.type.StringType" not-null="false" />
<property name="TfdArg14MandatoryFl" column="tfd_arg14_mandatory_fl" type="yes_no" not-null="true" />
<property name="TfdArg14Datatype" column="tfd_arg14_datatype" type="com.xxx.database.hibernate.type.StringType" not-null="false" />
<property name="TfdArg14SearchType" column="tfd_arg14_search_type" type="com.xxx.database.hibernate.type.StringType" not-null="false" />
<property name="TfdArg15Name" column="tfd_arg15_name" type="com.xxx.database.hibernate.type.StringType" not-null="false" />
<property name="TfdArg15MandatoryFl" column="tfd_arg15_mandatory_fl" type="yes_no" not-null="true" />
<property name="TfdArg15Datatype" column="tfd_arg15_datatype" type="com.xxx.database.hibernate.type.StringType" not-null="false" />
<property name="TfdArg15SearchType" column="tfd_arg15_search_type" type="com.xxx.database.hibernate.type.StringType" not-null="false" />
<property name="TfdArg16Name" column="tfd_arg16_name" type="com.xxx.database.hibernate.type.StringType" not-null="false" />
<property name="TfdArg16MandatoryFl" column="tfd_arg16_mandatory_fl" type="yes_no" not-null="true" />
<property name="TfdArg16Datatype" column="tfd_arg16_datatype" type="com.xxx.database.hibernate.type.StringType" not-null="false" />
<property name="TfdArg16SearchType" column="tfd_arg16_search_type" type="com.xxx.database.hibernate.type.StringType" not-null="false" />
<property name="TfdArg17Name" column="tfd_arg17_name" type="com.xxx.database.hibernate.type.StringType" not-null="false" />
<property name="TfdArg17MandatoryFl" column="tfd_arg17_mandatory_fl" type="yes_no" not-null="true" />
<property name="TfdArg17Datatype" column="tfd_arg17_datatype" type="com.xxx.database.hibernate.type.StringType" not-null="false" />
<property name="TfdArg17SearchType" column="tfd_arg17_search_type" type="com.xxx.database.hibernate.type.StringType" not-null="false" />
<property name="TfdArg18Name" column="tfd_arg18_name" type="com.xxx.database.hibernate.type.StringType" not-null="false" />
<property name="TfdArg18MandatoryFl" column="tfd_arg18_mandatory_fl" type="yes_no" not-null="true" />
<property name="TfdArg18Datatype" column="tfd_arg18_datatype" type="com.xxx.database.hibernate.type.StringType" not-null="false" />
<property name="TfdArg18SearchType" column="tfd_arg18_search_type" type="com.xxx.database.hibernate.type.StringType" not-null="false" />
<property name="TfdArg19Name" column="tfd_arg19_name" type="com.xxx.database.hibernate.type.StringType" not-null="false" />
<property name="TfdArg19MandatoryFl" column="tfd_arg19_mandatory_fl" type="yes_no" not-null="true" />
<property name="TfdArg19Datatype" column="tfd_arg19_datatype" type="com.xxx.database.hibernate.type.StringType" not-null="false" />
<property name="TfdArg19SearchType" column="tfd_arg19_search_type" type="com.xxx.database.hibernate.type.StringType" not-null="false" />
<property name="TfdArg20Name" column="tfd_arg20_name" type="com.xxx.database.hibernate.type.StringType" not-null="false" />
<property name="TfdArg20MandatoryFl" column="tfd_arg20_mandatory_fl" type="yes_no" not-null="true" />
<property name="TfdArg20Datatype" column="tfd_arg20_datatype" type="com.xxx.database.hibernate.type.StringType" not-null="false" />
<property name="TfdArg20SearchType" column="tfd_arg20_search_type" type="com.xxx.database.hibernate.type.StringType" not-null="false" />
<many-to-one name="ProductArgumentType" class="ProductArgumentTypeImpl" column="pat_id" update="false" insert="false" />
</class>
Name and version of the database you are using:
SQLServer 2000 jtds Driver
The generated SQL (show_sql=true):
select twentyfiel0_.tfd_id as tfd_id, twentyfiel0_.tfd_version_id as tfd_vers2_, twentyfiel0_.tfd_delete_fl as tfd_dele3_, twentyfiel0_.ptn_id as ptn_id, twentyfiel0_.pat_id as pat_id, twentyfiel0_.tfd_arg_count as tfd_arg_6_, twentyfiel0_.tfd_arg1_name as tfd_arg17_, twentyfiel0_.tfd_arg1_mandatory_fl as tfd_arg18_, twentyfiel0_.tfd_arg1_datatype as tfd_arg19_, twentyfiel0_.tfd_arg1_search_type as tfd_arg10_, twentyfiel0_.tfd_arg2_name as tfd_arg11_, twentyfiel0_.tfd_arg2_mandatory_fl as tfd_arg12_, twentyfiel0_.tfd_arg2_datatype as tfd_arg13_, twentyfiel0_.tfd_arg2_search_type as tfd_arg14_, twentyfiel0_.tfd_arg3_name as tfd_arg15_, twentyfiel0_.tfd_arg3_mandatory_fl as tfd_arg16_, twentyfiel0_.tfd_arg3_datatype as tfd_arg17_, twentyfiel0_.tfd_arg3_search_type as tfd_arg18_, twentyfiel0_.tfd_arg4_name as tfd_arg19_, twentyfiel0_.tfd_arg4_mandatory_fl as tfd_arg20_, twentyfiel0_.tfd_arg4_datatype as tfd_arg21_, twentyfiel0_.tfd_arg4_search_type as tfd_arg22_, twentyfiel0_.tfd_arg5_name as tfd_arg23_, twentyfiel0_.tfd_arg5_mandatory_fl as tfd_arg24_, twentyfiel0_.tfd_arg5_datatype as tfd_arg25_, twentyfiel0_.tfd_arg5_search_type as tfd_arg26_, twentyfiel0_.tfd_arg6_name as tfd_arg27_, twentyfiel0_.tfd_arg6_mandatory_fl as tfd_arg28_, twentyfiel0_.tfd_arg6_datatype as tfd_arg29_, twentyfiel0_.tfd_arg6_search_type as tfd_arg30_, twentyfiel0_.tfd_arg7_name as tfd_arg31_, twentyfiel0_.tfd_arg7_mandatory_fl as tfd_arg32_, twentyfiel0_.tfd_arg7_datatype as tfd_arg33_, twentyfiel0_.tfd_arg7_search_type as tfd_arg34_, twentyfiel0_.tfd_arg8_name as tfd_arg35_, twentyfiel0_.tfd_arg8_mandatory_fl as tfd_arg36_, twentyfiel0_.tfd_arg8_datatype as tfd_arg37_, twentyfiel0_.tfd_arg8_search_type as tfd_arg38_, twentyfiel0_.tfd_arg9_name as tfd_arg39_, twentyfiel0_.tfd_arg9_mandatory_fl as tfd_arg40_, twentyfiel0_.tfd_arg9_datatype as tfd_arg41_, twentyfiel0_.tfd_arg9_search_type as tfd_arg42_, twentyfiel0_.tfd_arg10_name as tfd_arg43_, twentyfiel0_.tfd_arg10_mandatory_fl as tfd_arg44_, twentyfiel0_.tfd_arg10_datatype as tfd_arg45_, twentyfiel0_.tfd_arg10_search_type as tfd_arg46_, twentyfiel0_.tfd_arg11_name as tfd_arg47_, twentyfiel0_.tfd_arg11_mandatory_fl as tfd_arg48_, twentyfiel0_.tfd_arg11_datatype as tfd_arg49_, twentyfiel0_.tfd_arg11_search_type as tfd_arg50_, twentyfiel0_.tfd_arg12_name as tfd_arg51_, twentyfiel0_.tfd_arg12_mandatory_fl as tfd_arg52_, twentyfiel0_.tfd_arg12_datatype as tfd_arg53_, twentyfiel0_.tfd_arg12_search_type as tfd_arg54_, twentyfiel0_.tfd_arg13_name as tfd_arg55_, twentyfiel0_.tfd_arg13_mandatory_fl as tfd_arg56_, twentyfiel0_.tfd_arg13_datatype as tfd_arg57_, twentyfiel0_.tfd_arg13_search_type as tfd_arg58_, twentyfiel0_.tfd_arg14_name as tfd_arg59_, twentyfiel0_.tfd_arg14_mandatory_fl as tfd_arg60_, twentyfiel0_.tfd_arg14_datatype as tfd_arg61_, twentyfiel0_.tfd_arg14_search_type as tfd_arg62_, twentyfiel0_.tfd_arg15_name as tfd_arg63_, twentyfiel0_.tfd_arg15_mandatory_fl as tfd_arg64_, twentyfiel0_.tfd_arg15_datatype as tfd_arg65_, twentyfiel0_.tfd_arg15_search_type as tfd_arg66_, twentyfiel0_.tfd_arg16_name as tfd_arg67_, twentyfiel0_.tfd_arg16_mandatory_fl as tfd_arg68_, twentyfiel0_.tfd_arg16_datatype as tfd_arg69_, twentyfiel0_.tfd_arg16_search_type as tfd_arg70_, twentyfiel0_.tfd_arg17_name as tfd_arg71_, twentyfiel0_.tfd_arg17_mandatory_fl as tfd_arg72_, twentyfiel0_.tfd_arg17_datatype as tfd_arg73_, twentyfiel0_.tfd_arg17_search_type as tfd_arg74_, twentyfiel0_.tfd_arg18_name as tfd_arg75_, twentyfiel0_.tfd_arg18_mandatory_fl as tfd_arg76_, twentyfiel0_.tfd_arg18_datatype as tfd_arg77_, twentyfiel0_.tfd_arg18_search_type as tfd_arg78_, twentyfiel0_.tfd_arg19_name as tfd_arg79_, twentyfiel0_.tfd_arg19_mandatory_fl as tfd_arg80_, twentyfiel0_.tfd_arg19_datatype as tfd_arg81_, twentyfiel0_.tfd_arg19_search_type as tfd_arg82_, twentyfiel0_.tfd_arg20_name as tfd_arg83_, twentyfiel0_.tfd_arg20_mandatory_fl as tfd_arg84_, twentyfiel0_.tfd_arg20_datatype as tfd_arg85_, twentyfiel0_.tfd_arg20_search_type as tfd_arg86_ from twenty_fields_dfn twentyfiel0_ where (twentyfiel0_.pat_id=? )
The problem is caused by the alias generation code. It generates the same alias for several of the columns in this situation for example tfd_arg17_ is aliased twice. The JDBC driver will silently ignore this ( which it probably shouldn't ) and for the 17th column it fetches the tfd_arg3_datatype column instead of the tfd_arg1_name column.
I think it is because of the number of the fields the first 17 is actually the 1 of the column with the 7 appended ( it's the seventh field ) to make it unique. Then the second one is the 17th column but it's now one character longer so the alias limit means the 3 gets removed and 17 put on the end.
I guess a fix would be to always seperate the unique id from the column name with an _ to prevent this happening, but you'll lose a column name character because of the alias length limit.
|