You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by "Gordon Reid (Nine Mile)" <go...@ninemilefinancial.com> on 2017/07/03 07:37:44 UTC

IGNITE-4548 does not seem to be completely fixed

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

RE: IGNITE-4548 does not seem to be completely fixed

Posted by "Gordon Reid (Nine Mile)" <go...@ninemilefinancial.com>.
Hi Mikhail,

Thanks for looking at this. I will create a reproducer for you.

Thanks,
Gordon.

From: Mikhail Cherkasov [mailto:mcherkasov@gridgain.com]
Sent: Tuesday, 4 July 2017 2:14 AM
To: user@ignite.apache.org
Subject: Re: IGNITE-4548 does not seem to be completely fixed

Hi Gordon,

Could you please send you pom project to debug it?
Looks like it was changes on purpose by this ticket: https://issues.apache.org/jira/browse/IGNITE-4949
but anyway, I want to check it with debugger, I will appreciate if you send your test case.

Thanks,
Mikhail.



On Mon, Jul 3, 2017 at 10:37 AM, Gordon Reid (Nine Mile) <go...@ninemilefinancial.com>> wrote:

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



--
Thanks,
Mikhail.


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

Re: IGNITE-4548 does not seem to be completely fixed

Posted by Mikhail Cherkasov <mc...@gridgain.com>.
Hi Gordon,

Could you please send you pom project to debug it?
Looks like it was changes on purpose by this ticket:
https://issues.apache.org/jira/browse/IGNITE-4949
but anyway, I want to check it with debugger, I will appreciate if you send
your test case.

Thanks,
Mikhail.



On Mon, Jul 3, 2017 at 10:37 AM, Gordon Reid (Nine Mile) <
gordon.reid@ninemilefinancial.com> wrote:

>
>
> 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
>



-- 
Thanks,
Mikhail.