Hi Ignite Experts,

I have tested the fix for IGNITE-4548

Say I have enum like this

public enum SecurityType {
    All,
    Stock,
    Future,
    Option,
    Commodity,
    ETF,
    Bond,
    Unknown,
    Equity,
    REIT,
    StapledSecurity,
    CurrencyPair
}

Using this JDBC config


vals.add(new JdbcTypeField(Types.VARCHAR, "securityType", SecurityType.class, 
"securityType"));

And some model class with field

@QuerySqlField(index=true)
private SecurityType securityType;


I can read a varchar from the database of "Bond" from the database into the 
cache, and the securityType field on the cache record will be 
SecurityType.Bond. GREAT.

BUT

When I save the record back to the database the enum ordinal "6" will be saved 
into the securityType column. This is not what we want.

  1.  It makes reading the database difficult. 6 means nothing to someone who 
can't see the code.
  2.  More importantly, the enum may be refactored over time, and "6" may 
represent something else in future

Reading string value from database into the enum field is working fine. But is 
there a way I can force ignite to save the string value of the Enum into the 
database also?

Thanks,
Gordon.


This email and any attachments are proprietary & confidential and are intended 
solely for the use of the individuals to whom it is addressed. Any views or 
opinions expressed are solely for those of the author and do not necessarily 
reflect those of Nine Mile Financial Pty. Limited. If you have received this 
email in error, please let us know immediately by reply email and delete from 
your system. Nine Mile Financial Pty. Limited. ABN: 346 1349 0252

Reply via email to