Re: How to use Binarylizable interface or Externalizable on my custom Key?

2018-06-04 Thread the_palakkaran
I figured out the solution for this. 

Just implement Externalizable and you can override equals and hashcode
method.

//Key is unique for each cache entry. So, it is impossible to get entry by a
part of key.//

I understand that, I was checking for a way to do that.

Thanks a lot for the confirmation, Andrew.




--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/


Re: How to use Binarylizable interface or Externalizable on my custom Key?

2018-06-04 Thread Andrey Mashenkov
Hi,

You are free to use any hashcode and equals in your classes.
Ignite will convert your POJO to BinaryObject before save to cache and use
it's own hashing anyway.

It still unclear what are trying to do.
Key is unique for each cache entry. So, it is impossible to get entry by a
part of key.
You should use SQL API for this instead.


On Mon, Jun 4, 2018 at 12:31 PM, the_palakkaran 
wrote:

> Hi Andrew,
>
> I need to somehow override the equals and hashcode method in my key class.
>
> ie;
>
> I have a CustomerKey and CustomerModel configured in a customerCache. I
> need
> to get results from the cache based on the key class that I am passing to
> the cache for query.
>
> like when I pass a key class to the cache that has an equals method in
> which
> I have something like customerNumber == obj.CustomerNo, I need to get
> results based on it. So basically during put to cache also, this equals
> method should have been executed.
>
> Is there any way I could achieve this using Binary Objects or Binarylizable
> or Externalizable ?
>
>
>
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>



-- 
Best regards,
Andrey V. Mashenkov


Re: How to use Binarylizable interface or Externalizable on my custom Key?

2018-06-04 Thread the_palakkaran
Hi Andrew,

I need to somehow override the equals and hashcode method in my key class.

ie;

I have a CustomerKey and CustomerModel configured in a customerCache. I need
to get results from the cache based on the key class that I am passing to
the cache for query. 

like when I pass a key class to the cache that has an equals method in which
I have something like customerNumber == obj.CustomerNo, I need to get
results based on it. So basically during put to cache also, this equals
method should have been executed.

Is there any way I could achieve this using Binary Objects or Binarylizable
or Externalizable ?



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/


Re: How to use Binarylizable interface or Externalizable on my custom Key?

2018-06-04 Thread Andrey Mashenkov
Hi,

Would you please describe your scenario? Why you need to use binarylizable
or Externalizable?

Ignite allows overriding methods, but ignores object's hashcode and equals and
rely on its own implementation.
Ignite operates with BinaryObjects underneath and use BinaryObject hash
codes.
This allows to use BinaryObjects on server side and the requirement of
having user objects in classpath on server side is optional.

On Mon, Jun 4, 2018 at 9:38 AM, the_palakkaran  wrote:

> Hi,
>
> I understand that by default, ignite does not allow override hash code and
> equals method. I need it to handle my scenarios, so i came across
> Binarylizable interface.
>
> How to do this? Not so clear from documentation.
>
>
>
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>



-- 
Best regards,
Andrey V. Mashenkov


How to use Binarylizable interface or Externalizable on my custom Key?

2018-06-03 Thread the_palakkaran
Hi,

I understand that by default, ignite does not allow override hash code and
equals method. I need it to handle my scenarios, so i came across
Binarylizable interface.

How to do this? Not so clear from documentation.



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/