[jira] [Commented] (IGNITE-3429) org.hibernate.cache.spi.CacheKey not properly serialized by binary marshaller

2017-04-20 Thread Semen Boikov (JIRA)

[ 
https://issues.apache.org/jira/browse/IGNITE-3429?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15976847#comment-15976847
 ] 

Semen Boikov commented on IGNITE-3429:
--

Implemented multi-jvm test which fails with BinaryMarshaller in 1.9 and pass 
with 2.0, so I can consider workaround with BinaryIdentityResolvers is not 
needed in current implementation.

> org.hibernate.cache.spi.CacheKey not properly serialized by binary marshaller
> -
>
> Key: IGNITE-3429
> URL: https://issues.apache.org/jira/browse/IGNITE-3429
> Project: Ignite
>  Issue Type: Sub-task
>  Components: cache, Hibernate L2 cache
>Affects Versions: 1.6
>Reporter: Valentin Kulichenko
>Assignee: Semen Boikov
>Priority: Blocker
> Fix For: 2.0
>
>
> {{org.hibernate.cache.spi.CacheKey}} is a class used as a key for all entries 
> in the Hibernate L2 cache. This class contains {{type}} field and custom 
> {{equals}} logic where the type is used as a helper and does not participate 
> in comparison. Instances of the same type are producing different hash codes 
> in different JVMs, which actually breaks comparison when binary format is 
> used, where byte arrays are compared.
> The issue is described in more detail here: 
> http://stackoverflow.com/questions/38132263/apache-ignite-as-hibernate-l2-cache-storing-duplicate-entities



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Commented] (IGNITE-3429) org.hibernate.cache.spi.CacheKey not properly serialized by binary marshaller

2017-04-18 Thread Denis Magda (JIRA)

[ 
https://issues.apache.org/jira/browse/IGNITE-3429?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15973399#comment-15973399
 ] 

Denis Magda commented on IGNITE-3429:
-

Binary resolvers based workaround is no longer applicable for 2.0. The issue 
has to be fixed differently. See the discussion:
http://apache-ignite-developers.2346864.n4.nabble.com/Stable-binary-key-representation-td15904.html

> org.hibernate.cache.spi.CacheKey not properly serialized by binary marshaller
> -
>
> Key: IGNITE-3429
> URL: https://issues.apache.org/jira/browse/IGNITE-3429
> Project: Ignite
>  Issue Type: Sub-task
>  Components: cache, Hibernate L2 cache
>Affects Versions: 1.6
>Reporter: Valentin Kulichenko
>Assignee: Andrew Mashenkov
>Priority: Blocker
> Fix For: 2.0
>
>
> {{org.hibernate.cache.spi.CacheKey}} is a class used as a key for all entries 
> in the Hibernate L2 cache. This class contains {{type}} field and custom 
> {{equals}} logic where the type is used as a helper and does not participate 
> in comparison. Instances of the same type are producing different hash codes 
> in different JVMs, which actually breaks comparison when binary format is 
> used, where byte arrays are compared.
> The issue is described in more detail here: 
> http://stackoverflow.com/questions/38132263/apache-ignite-as-hibernate-l2-cache-storing-duplicate-entities



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Commented] (IGNITE-3429) org.hibernate.cache.spi.CacheKey not properly serialized by binary marshaller

2017-03-17 Thread Denis Magda (JIRA)

[ 
https://issues.apache.org/jira/browse/IGNITE-3429?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15930885#comment-15930885
 ] 

Denis Magda commented on IGNITE-3429:
-

[~amashenkov], as a side note, please don't forget to update this documentation 
section once the ticket is merged:
https://apacheignite-mix.readme.io/docs/hibernate-l2-cache#section-l2-cache-configuration

Assign the ticket on me for the documentation review. Negotiated?

> org.hibernate.cache.spi.CacheKey not properly serialized by binary marshaller
> -
>
> Key: IGNITE-3429
> URL: https://issues.apache.org/jira/browse/IGNITE-3429
> Project: Ignite
>  Issue Type: Bug
>  Components: cache, Hibernate L2 cache
>Affects Versions: 1.6
>Reporter: Valentin Kulichenko
>Assignee: Andrew Mashenkov
> Fix For: 2.0
>
>
> {{org.hibernate.cache.spi.CacheKey}} is a class used as a key for all entries 
> in the Hibernate L2 cache. This class contains {{type}} field and custom 
> {{equals}} logic where the type is used as a helper and does not participate 
> in comparison. Instances of the same type are producing different hash codes 
> in different JVMs, which actually breaks comparison when binary format is 
> used, where byte arrays are compared.
> The issue is described in more detail here: 
> http://stackoverflow.com/questions/38132263/apache-ignite-as-hibernate-l2-cache-storing-duplicate-entities



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Commented] (IGNITE-3429) org.hibernate.cache.spi.CacheKey not properly serialized by binary marshaller

2017-03-16 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/IGNITE-3429?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15928131#comment-15928131
 ] 

ASF GitHub Bot commented on IGNITE-3429:


GitHub user AMashenkov opened a pull request:

https://github.com/apache/ignite/pull/1629

IGNITE-3429: org.hibernate.cache.spi.CacheKey not properly serialized by 
binary marshaller 



You can merge this pull request into a Git repository by running:

$ git pull https://github.com/gridgain/apache-ignite ignite-3429

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/ignite/pull/1629.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #1629


commit 630da94351e71b418b7b605eeec66ab67c1b4884
Author: AMRepo 
Date:   2017-02-09T15:21:18Z

Implemented




> org.hibernate.cache.spi.CacheKey not properly serialized by binary marshaller
> -
>
> Key: IGNITE-3429
> URL: https://issues.apache.org/jira/browse/IGNITE-3429
> Project: Ignite
>  Issue Type: Bug
>  Components: cache, Hibernate L2 cache
>Affects Versions: 1.6
>Reporter: Valentin Kulichenko
>Assignee: Andrew Mashenkov
> Fix For: 2.0
>
>
> {{org.hibernate.cache.spi.CacheKey}} is a class used as a key for all entries 
> in the Hibernate L2 cache. This class contains {{type}} field and custom 
> {{equals}} logic where the type is used as a helper and does not participate 
> in comparison. Instances of the same type are producing different hash codes 
> in different JVMs, which actually breaks comparison when binary format is 
> used, where byte arrays are compared.
> The issue is described in more detail here: 
> http://stackoverflow.com/questions/38132263/apache-ignite-as-hibernate-l2-cache-storing-duplicate-entities



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Commented] (IGNITE-3429) org.hibernate.cache.spi.CacheKey not properly serialized by binary marshaller

2017-03-16 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/IGNITE-3429?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15928039#comment-15928039
 ] 

ASF GitHub Bot commented on IGNITE-3429:


Github user asfgit closed the pull request at:

https://github.com/apache/ignite/pull/1516


> org.hibernate.cache.spi.CacheKey not properly serialized by binary marshaller
> -
>
> Key: IGNITE-3429
> URL: https://issues.apache.org/jira/browse/IGNITE-3429
> Project: Ignite
>  Issue Type: Bug
>  Components: cache, Hibernate L2 cache
>Affects Versions: 1.6
>Reporter: Valentin Kulichenko
>Assignee: Andrew Mashenkov
> Fix For: 2.0
>
>
> {{org.hibernate.cache.spi.CacheKey}} is a class used as a key for all entries 
> in the Hibernate L2 cache. This class contains {{type}} field and custom 
> {{equals}} logic where the type is used as a helper and does not participate 
> in comparison. Instances of the same type are producing different hash codes 
> in different JVMs, which actually breaks comparison when binary format is 
> used, where byte arrays are compared.
> The issue is described in more detail here: 
> http://stackoverflow.com/questions/38132263/apache-ignite-as-hibernate-l2-cache-storing-duplicate-entities



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Commented] (IGNITE-3429) org.hibernate.cache.spi.CacheKey not properly serialized by binary marshaller

2017-02-10 Thread Andrew Mashenkov (JIRA)

[ 
https://issues.apache.org/jira/browse/IGNITE-3429?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15861798#comment-15861798
 ] 

Andrew Mashenkov commented on IGNITE-3429:
--

I see org.hibernate.cache.internal.OldCacheKeyImplementation class only in 
5.0.x RC versions. 
In >=5.0 stable versions has class named 
org.hibernate.cache.internal.CacheKeyImplementation.

> org.hibernate.cache.spi.CacheKey not properly serialized by binary marshaller
> -
>
> Key: IGNITE-3429
> URL: https://issues.apache.org/jira/browse/IGNITE-3429
> Project: Ignite
>  Issue Type: Bug
>  Components: cache, Hibernate L2 cache
>Affects Versions: 1.6
>Reporter: Valentin Kulichenko
>Assignee: Andrew Mashenkov
>Priority: Critical
> Fix For: 2.0
>
>
> {{org.hibernate.cache.spi.CacheKey}} is a class used as a key for all entries 
> in the Hibernate L2 cache. This class contains {{type}} field and custom 
> {{equals}} logic where the type is used as a helper and does not participate 
> in comparison. Instances of the same type are producing different hash codes 
> in different JVMs, which actually breaks comparison when binary format is 
> used, where byte arrays are compared.
> The issue is described in more detail here: 
> http://stackoverflow.com/questions/38132263/apache-ignite-as-hibernate-l2-cache-storing-duplicate-entities



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Commented] (IGNITE-3429) org.hibernate.cache.spi.CacheKey not properly serialized by binary marshaller

2017-02-10 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/IGNITE-3429?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15861026#comment-15861026
 ] 

ASF GitHub Bot commented on IGNITE-3429:


GitHub user AMashenkov opened a pull request:

https://github.com/apache/ignite/pull/1516

IGNITE-3429: org.hibernate.cache.spi.CacheKey not properly serialized by 
binary marshaller

Sample comfigurations for CacheKey added. 

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/gridgain/apache-ignite ignite-3429

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/ignite/pull/1516.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #1516


commit 630da94351e71b418b7b605eeec66ab67c1b4884
Author: AMRepo 
Date:   2017-02-09T15:21:18Z

Implemented




> org.hibernate.cache.spi.CacheKey not properly serialized by binary marshaller
> -
>
> Key: IGNITE-3429
> URL: https://issues.apache.org/jira/browse/IGNITE-3429
> Project: Ignite
>  Issue Type: Bug
>  Components: cache, Hibernate L2 cache
>Affects Versions: 1.6
>Reporter: Valentin Kulichenko
>Assignee: Andrew Mashenkov
>Priority: Critical
> Fix For: 2.0
>
>
> {{org.hibernate.cache.spi.CacheKey}} is a class used as a key for all entries 
> in the Hibernate L2 cache. This class contains {{type}} field and custom 
> {{equals}} logic where the type is used as a helper and does not participate 
> in comparison. Instances of the same type are producing different hash codes 
> in different JVMs, which actually breaks comparison when binary format is 
> used, where byte arrays are compared.
> The issue is described in more detail here: 
> http://stackoverflow.com/questions/38132263/apache-ignite-as-hibernate-l2-cache-storing-duplicate-entities



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Commented] (IGNITE-3429) org.hibernate.cache.spi.CacheKey not properly serialized by binary marshaller

2017-02-09 Thread Fred (JIRA)

[ 
https://issues.apache.org/jira/browse/IGNITE-3429?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15860221#comment-15860221
 ] 

Fred commented on IGNITE-3429:
--

By chance, does anyone have some examples / tests?  Upgraded to apache ignite 
1.8.  I configured BinaryTypeConfiguration with 
(org.hibernate.cache.internal.OldCacheKeyImplementation) from above then used 
files from https://issues.apache.org/jira/browse/IGNITE-1794 since on Hibernate 
5.2.7.  I noticed the BinaryAbstractIdentityResolver being called and returning 
true but when I call the same service I noticed the database being hit.

XML Configuration from 
http://apacheignite.gridgain.org/v1.6/docs/hibernate-l2-cache
```
hibernate.cache.use_query_cache=true
hibernate.cache.use_second_level_cache=true
hibernate.cache.region.factory_class=org.apache.ignite.cache.hibernate.HibernateRegionFactory
org.apache.ignite.hibernate.default_access_type=READ_ONLY


 


@Entity(name = "Person")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class Person
```

> org.hibernate.cache.spi.CacheKey not properly serialized by binary marshaller
> -
>
> Key: IGNITE-3429
> URL: https://issues.apache.org/jira/browse/IGNITE-3429
> Project: Ignite
>  Issue Type: Bug
>  Components: cache, Hibernate L2 cache
>Affects Versions: 1.6
>Reporter: Valentin Kulichenko
>Assignee: Andrew Mashenkov
>Priority: Critical
> Fix For: 2.0
>
>
> {{org.hibernate.cache.spi.CacheKey}} is a class used as a key for all entries 
> in the Hibernate L2 cache. This class contains {{type}} field and custom 
> {{equals}} logic where the type is used as a helper and does not participate 
> in comparison. Instances of the same type are producing different hash codes 
> in different JVMs, which actually breaks comparison when binary format is 
> used, where byte arrays are compared.
> The issue is described in more detail here: 
> http://stackoverflow.com/questions/38132263/apache-ignite-as-hibernate-l2-cache-storing-duplicate-entities



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Commented] (IGNITE-3429) org.hibernate.cache.spi.CacheKey not properly serialized by binary marshaller

2017-02-03 Thread Cameron Braid (JIRA)

[ 
https://issues.apache.org/jira/browse/IGNITE-3429?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15852642#comment-15852642
 ] 

Cameron Braid commented on IGNITE-3429:
---

For hibernate 5 since CacheKey doesn't exist, use the following :
{code}
BinaryConfiguration bCfg = new BinaryConfiguration();

BinaryTypeConfiguration btCfg = new BinaryTypeConfiguration();

// must be a string since class is not public

btCfg.setTypeName("org.hibernate.cache.internal.OldCacheKeyImplementation");
btCfg.setIdentityResolver(new BinaryAbstractIdentityResolver() {
@Override protected int hashCode0(BinaryObject obj) {
return obj.field("id").hashCode();
}

@Override protected boolean equals0(BinaryObject o1, BinaryObject 
o2) {
Object obj0 = o1.field("id");
Object obj1 = o2.field("id");

return Objects.equals(obj0, obj1);
}
});

bCfg.setTypeConfigurations(Collections.singleton(btCfg));
igniteConfig.setBinaryConfiguration(bCfg);
{code}

> org.hibernate.cache.spi.CacheKey not properly serialized by binary marshaller
> -
>
> Key: IGNITE-3429
> URL: https://issues.apache.org/jira/browse/IGNITE-3429
> Project: Ignite
>  Issue Type: Bug
>  Components: cache, Hibernate L2 cache
>Affects Versions: 1.6
>Reporter: Valentin Kulichenko
>Priority: Critical
> Fix For: 2.0
>
>
> {{org.hibernate.cache.spi.CacheKey}} is a class used as a key for all entries 
> in the Hibernate L2 cache. This class contains {{type}} field and custom 
> {{equals}} logic where the type is used as a helper and does not participate 
> in comparison. Instances of the same type are producing different hash codes 
> in different JVMs, which actually breaks comparison when binary format is 
> used, where byte arrays are compared.
> The issue is described in more detail here: 
> http://stackoverflow.com/questions/38132263/apache-ignite-as-hibernate-l2-cache-storing-duplicate-entities



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Commented] (IGNITE-3429) org.hibernate.cache.spi.CacheKey not properly serialized by binary marshaller

2017-01-24 Thread Denis Magda (JIRA)

[ 
https://issues.apache.org/jira/browse/IGNITE-3429?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15836819#comment-15836819
 ] 

Denis Magda commented on IGNITE-3429:
-

Agree, let's do it a part of the product. For now I'll update the documentation 
suggesting to use the identity resolver instead of optimized marshaller.

> org.hibernate.cache.spi.CacheKey not properly serialized by binary marshaller
> -
>
> Key: IGNITE-3429
> URL: https://issues.apache.org/jira/browse/IGNITE-3429
> Project: Ignite
>  Issue Type: Bug
>  Components: cache
>Affects Versions: 1.6
>Reporter: Valentin Kulichenko
>Priority: Critical
> Fix For: 2.0
>
>
> {{org.hibernate.cache.spi.CacheKey}} is a class used as a key for all entries 
> in the Hibernate L2 cache. This class contains {{type}} field and custom 
> {{equals}} logic where the type is used as a helper and does not participate 
> in comparison. Instances of the same type are producing different hash codes 
> in different JVMs, which actually breaks comparison when binary format is 
> used, where byte arrays are compared.
> The issue is described in more detail here: 
> http://stackoverflow.com/questions/38132263/apache-ignite-as-hibernate-l2-cache-storing-duplicate-entities



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (IGNITE-3429) org.hibernate.cache.spi.CacheKey not properly serialized by binary marshaller

2017-01-23 Thread Andrew Mashenkov (JIRA)

[ 
https://issues.apache.org/jira/browse/IGNITE-3429?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15834441#comment-15834441
 ] 

Andrew Mashenkov commented on IGNITE-3429:
--

[~vkulichenko],
Should we add IdentityResolver implementation mentioned above by [~ntikhonov] 
to ignite-hibernate module or\and update documentation to resolve this ticket?




> org.hibernate.cache.spi.CacheKey not properly serialized by binary marshaller
> -
>
> Key: IGNITE-3429
> URL: https://issues.apache.org/jira/browse/IGNITE-3429
> Project: Ignite
>  Issue Type: Bug
>  Components: cache
>Affects Versions: 1.6
>Reporter: Valentin Kulichenko
>Priority: Critical
> Fix For: 2.0
>
>
> {{org.hibernate.cache.spi.CacheKey}} is a class used as a key for all entries 
> in the Hibernate L2 cache. This class contains {{type}} field and custom 
> {{equals}} logic where the type is used as a helper and does not participate 
> in comparison. Instances of the same type are producing different hash codes 
> in different JVMs, which actually breaks comparison when binary format is 
> used, where byte arrays are compared.
> The issue is described in more detail here: 
> http://stackoverflow.com/questions/38132263/apache-ignite-as-hibernate-l2-cache-storing-duplicate-entities



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (IGNITE-3429) org.hibernate.cache.spi.CacheKey not properly serialized by binary marshaller

2017-01-17 Thread Nikolay Tikhonov (JIRA)

[ 
https://issues.apache.org/jira/browse/IGNITE-3429?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15826179#comment-15826179
 ] 

Nikolay Tikhonov commented on IGNITE-3429:
--

As workaround for the issue can be used the following {{BinaryIdentityResolver}}

{noformat}
BinaryConfiguration bCfg = new BinaryConfiguration();

BinaryTypeConfiguration btCfg = new BinaryTypeConfiguration();

btCfg.setTypeName(org.hibernate.cache.spi.CacheKey.class.getName());
btCfg.setIdentityResolver(new BinaryAbstractIdentityResolver() {
@Override protected int hashCode0(BinaryObject obj) {
return ((CacheKey)obj.deserialize()).getKey().hashCode();
}

@Override protected boolean equals0(BinaryObject o1, BinaryObject 
o2) {
Serializable obj0 = ((CacheKey)o1.deserialize()).getKey();
Serializable obj1 = ((CacheKey)o2.deserialize()).getKey();

return obj0.equals(obj1);
}
});

bCfg.setTypeConfigurations(Collections.singleton(btCfg));

IgniteConfiguration igniteConfiguration = new IgniteConfiguration()
.setBinaryConfiguration(bCfg);
{noformat}

> org.hibernate.cache.spi.CacheKey not properly serialized by binary marshaller
> -
>
> Key: IGNITE-3429
> URL: https://issues.apache.org/jira/browse/IGNITE-3429
> Project: Ignite
>  Issue Type: Bug
>  Components: cache
>Affects Versions: 1.6
>Reporter: Valentin Kulichenko
>Priority: Critical
> Fix For: 2.0
>
>
> {{org.hibernate.cache.spi.CacheKey}} is a class used as a key for all entries 
> in the Hibernate L2 cache. This class contains {{type}} field and custom 
> {{equals}} logic where the type is used as a helper and does not participate 
> in comparison. Instances of the same type are producing different hash codes 
> in different JVMs, which actually breaks comparison when binary format is 
> used, where byte arrays are compared.
> The issue is described in more detail here: 
> http://stackoverflow.com/questions/38132263/apache-ignite-as-hibernate-l2-cache-storing-duplicate-entities



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (IGNITE-3429) org.hibernate.cache.spi.CacheKey not properly serialized by binary marshaller

2016-11-17 Thread Fred (JIRA)

[ 
https://issues.apache.org/jira/browse/IGNITE-3429?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15673619#comment-15673619
 ] 

Fred commented on IGNITE-3429:
--

That hurts pushing it to 2.0, I havent found a solid way of getting Hibernate 
L2 cache working:
http://stackoverflow.com/questions/38132263/apache-ignite-as-hibernate-l2-cache-storing-duplicate-entities
http://stackoverflow.com/questions/40140645/apache-ignite-hibernate-sessionfactory-serialization-issue
https://issues.apache.org/jira/browse/IGNITE-1794
http://apacheignite.gridgain.org/docs/binary-marshaller

> org.hibernate.cache.spi.CacheKey not properly serialized by binary marshaller
> -
>
> Key: IGNITE-3429
> URL: https://issues.apache.org/jira/browse/IGNITE-3429
> Project: Ignite
>  Issue Type: Bug
>  Components: cache
>Affects Versions: 1.6
>Reporter: Valentin Kulichenko
>Priority: Critical
> Fix For: 2.0
>
>
> {{org.hibernate.cache.spi.CacheKey}} is a class used as a key for all entries 
> in the Hibernate L2 cache. This class contains {{type}} field and custom 
> {{equals}} logic where the type is used as a helper and does not participate 
> in comparison. Instances of the same type are producing different hash codes 
> in different JVMs, which actually breaks comparison when binary format is 
> used, where byte arrays are compared.
> The issue is described in more detail here: 
> http://stackoverflow.com/questions/38132263/apache-ignite-as-hibernate-l2-cache-storing-duplicate-entities



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (IGNITE-3429) org.hibernate.cache.spi.CacheKey not properly serialized by binary marshaller

2016-10-05 Thread Fred (JIRA)

[ 
https://issues.apache.org/jira/browse/IGNITE-3429?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15549447#comment-15549447
 ] 

Fred commented on IGNITE-3429:
--

I put in a temporary workaround in the time being which sets SessionFactory to 
null:

```
public class SgrOptimizedMarshaller extends OptimizedMarshaller {

@Override
public byte[] marshal(Object obj) throws IgniteCheckedException {

if (obj instanceof CacheKey) {
CacheKey key = (CacheKey) obj;
Class cacheKeyClazz = obj.getClass();

try {
Field typeField = 
cacheKeyClazz.getDeclaredField("type");
typeField.setAccessible(true);
Type hibernateType = (Type) typeField.get(key);
if (hibernateType instanceof ComponentType) {
ComponentType componentType = 
(ComponentType) hibernateType;
Class componentTypeClazz = 
componentType.getClass();
Field componentTypeField = 
componentTypeClazz.getDeclaredField("typeScope");
componentTypeField.setAccessible(true);
componentTypeField.set(componentType, 
null);
}
} catch (Exception ex) {
System.out.println(ex.toString());
}
}
return super.marshal(obj);
}

}
```

> org.hibernate.cache.spi.CacheKey not properly serialized by binary marshaller
> -
>
> Key: IGNITE-3429
> URL: https://issues.apache.org/jira/browse/IGNITE-3429
> Project: Ignite
>  Issue Type: Bug
>  Components: cache
>Affects Versions: 1.6
>Reporter: Valentin Kulichenko
>Priority: Critical
> Fix For: 1.8
>
>
> {{org.hibernate.cache.spi.CacheKey}} is a class used as a key for all entries 
> in the Hibernate L2 cache. This class contains {{type}} field and custom 
> {{equals}} logic where the type is used as a helper and does not participate 
> in comparison. Instances of the same type are producing different hash codes 
> in different JVMs, which actually breaks comparison when binary format is 
> used, where byte arrays are compared.
> The issue is described in more detail here: 
> http://stackoverflow.com/questions/38132263/apache-ignite-as-hibernate-l2-cache-storing-duplicate-entities



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (IGNITE-3429) org.hibernate.cache.spi.CacheKey not properly serialized by binary marshaller

2016-10-05 Thread Fred (JIRA)

[ 
https://issues.apache.org/jira/browse/IGNITE-3429?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15548523#comment-15548523
 ] 

Fred commented on IGNITE-3429:
--

Having issues when using OptimizedMarshaller and @EmbeddedId.

OptimizedMarshaller.marhsal(Object obj)
obj.type appears to be org.hibernate.type.ComponentType which doesnt appear to 
be marshalled / unmarshalled correctly:

Caused by: org.hibernate.cache.CacheException: class 
org.apache.ignite.IgniteCheckedException: Failed to deserialize object with 
given class loader: 
org.apache.ignite.internal.processors.cache.GridCacheDeploymentManager$CacheClassLoader@1ca4a47
at 
org.apache.ignite.cache.hibernate.HibernateReadWriteAccessStrategy.get(HibernateReadWriteAccessStrategy.java:89)
at 
org.apache.ignite.cache.hibernate.HibernateAbstractRegionAccessStrategy.get(HibernateAbstractRegionAccessStrategy.java:41)
at 
org.hibernate.engine.internal.CacheHelper.fromSharedCache(CacheHelper.java:55)
at 
org.hibernate.engine.internal.CacheHelper.fromSharedCache(CacheHelper.java:67)
at 
org.hibernate.event.internal.DefaultLoadEventListener.loadFromSecondLevelCache(DefaultLoadEventListener.java:598)
at 
org.hibernate.event.internal.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:452)
at 
org.hibernate.event.internal.DefaultLoadEventListener.load(DefaultLoadEventListener.java:213)
at 
org.hibernate.event.internal.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:275)
at 
org.hibernate.event.internal.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:151)
at org.hibernate.internal.SessionImpl.fireLoad(SessionImpl.java:1106)
at org.hibernate.internal.SessionImpl.access$2000(SessionImpl.java:176)
at 
org.hibernate.internal.SessionImpl$IdentifierLoadAccessImpl.load(SessionImpl.java:2587)
at org.hibernate.internal.SessionImpl.get(SessionImpl.java:991)
at 
org.hibernate.jpa.spi.AbstractEntityManagerImpl.find(AbstractEntityManagerImpl.java:1110)
Caused by: class org.apache.ignite.IgniteCheckedException: Failed to 
deserialize object with given class loader: 
org.apache.ignite.internal.processors.cache.GridCacheDeploymentManager$CacheClassLoader@1ca4a47
at 
org.apache.ignite.marshaller.optimized.OptimizedMarshaller.unmarshal(OptimizedMarshaller.java:250)
at 
org.apache.ignite.internal.processors.cacheobject.IgniteCacheObjectProcessorImpl.unmarshal(IgniteCacheObjectProcessorImpl.java:111)
at 
org.apache.ignite.internal.processors.cache.binary.CacheObjectBinaryProcessorImpl.unmarshal(CacheObjectBinaryProcessorImpl.java:766)
at 
org.apache.ignite.internal.processors.cache.KeyCacheObjectImpl.finishUnmarshal(KeyCacheObjectImpl.java:147)
at 
org.apache.ignite.internal.processors.cache.distributed.near.GridNearSingleGetRequest.finishUnmarshal(GridNearSingleGetRequest.java:246)
at 
org.apache.ignite.internal.processors.cache.GridCacheIoManager.unmarshall(GridCacheIoManager.java:1215)
at 
org.apache.ignite.internal.processors.cache.GridCacheIoManager.onMessage0(GridCacheIoManager.java:348)
at 
org.apache.ignite.internal.processors.cache.GridCacheIoManager.handleMessage(GridCacheIoManager.java:277)
at 
org.apache.ignite.internal.processors.cache.GridCacheIoManager.access$000(GridCacheIoManager.java:88)
at 
org.apache.ignite.internal.processors.cache.GridCacheIoManager$1.onMessage(GridCacheIoManager.java:231)
at 
org.apache.ignite.internal.managers.communication.GridIoManager.invokeListener(GridIoManager.java:1238)
at 
org.apache.ignite.internal.managers.communication.GridIoManager.processRegularMessage0(GridIoManager.java:866)
at 
org.apache.ignite.internal.managers.communication.GridIoManager.access$1700(GridIoManager.java:106)
at 
org.apache.ignite.internal.managers.communication.GridIoManager$5.run(GridIoManager.java:829)
Caused by: java.io.InvalidObjectException: Could not find a SessionFactory 
[uuid=66fcaa43-9434-45f8-8f34-e3f9f3e11d51,name=null]
at 
org.hibernate.internal.SessionFactoryImpl.locateSessionFactoryOnDeserialization(SessionFactoryImpl.java:1781)
at 
org.hibernate.internal.SessionFactoryImpl.readResolve(SessionFactoryImpl.java:1761)

> org.hibernate.cache.spi.CacheKey not properly serialized by binary marshaller
> -
>
> Key: IGNITE-3429
> URL: https://issues.apache.org/jira/browse/IGNITE-3429
> Project: Ignite
>  Issue Type: Bug
>  Components: cache
>Affects Versions: 1.6
>Reporter: Valentin Kulichenko
>Priority: Critical
> Fix For: 1.8
>
>
> {{org.hibernate.cache.spi.CacheKey}} is a class used as a key for all entries 
> in the Hibernate