Hi, Thank you for the email. What about EmpInfo? Main class and child class having EmpName field (error 1)
Thanks and Regards, Charlin On Wed, 24 Apr, 2024, 4:25 pm Pavel Tupitsyn, <ptupit...@apache.org> wrote: > Employee class has two fields with the same name: > > [QuerySqlField] > public string EMPCode { get; set; } > > [QuerySqlField] > public string EmpCode { get; set; } > > > Ignite 2.10 ignored this and used only one of those for SQL, which may > lead to subtle bugs. So we added this validation. > > You'll have to rename one of the fields, or override SQL field name in the > attribute: > [QuerySqlField(Name = "EMPCode2")] > > On Wed, Apr 24, 2024 at 10:01 AM Charlin S <charli...@hotelhub.com> wrote: > >> Hi All, >> I am upgrading Ignite from 2.10 to 2.16 and getting Multiple query fields >> are associated with the same alias error for *EMPCode* and *EmpName, *which >> is working with Ignite 2.10. unable to create Employee cache. >> >> Error 1: >> System.Exception: IgniteException for chache :: Employee >> ---> Apache.Ignite.Core.Cache.CacheException: class >> org.apache.ignite.IgniteCheckedException: Multiple query fields are >> associated with the same alias [alias=EMPNAME] >> >> Error 2: >> System.Exception: IgniteException for chache :: Employee >> ---> Apache.Ignite.Core.Cache.CacheException: class >> org.apache.ignite.IgniteCheckedException: Multiple query fields are >> associated with the same alias [alias=EMPCODE] >> >> Error 2 can be corrected by removing TmcCode property but why same error >> for EmpName? >> >> my class file >> Public class Employee: IBinarizable >> { >> [QuerySqlField] >> public string EMPCode { get; set; } >> [QuerySqlField] >> public string EmpCode { get; set; } >> [QuerySqlField] >> public string EmpName { get; set; } >> [QuerySqlField] >> public EmpInfo EmpInformation { get; set; } >> >> public void WriteBinary(IBinaryWriter writer) >> { >> if (writer != null) >> { >> writer.WriteString("empcode", EMPCode); >> writer.WriteString("empname", EmpName ); >> writer.WriteObject(" empInformation", EmpInformation ); >> } >> } >> public void ReadBinary(IBinaryReader reader) >> { >> if (reader != null) >> { >> EMPCode = reader.ReadString("empcode"); >> EmpName = reader.ReadString("empname"); >> EmpInformation = reader.ReadString(" >> empInformation"); >> } >> } >> } >> >> public class EmpInfo : IBinarizable >> { >> [QuerySqlField] >> public string EmpName { get; set; } >> [QuerySqlField] >> public string EmpAddress{ get; set; } >> >> public void WriteBinary(IBinaryWriter writer) >> { >> if (writer != null) >> { >> writer.WriteString(" empname ", EmpName ); >> writer.WriteString(" empaddress ", EmpAddress ); >> } >> } >> public void ReadBinary(IBinaryReader reader) >> { >> if (reader != null) >> { >> EmpName = reader.ReadString(" empname "); >> EmpAddress = reader.ReadString(" empaddress "); >> } >> } >> } >> >> Thanks & Regards, >> Charlin >> >> >>