Hi,
I've just started using hibernate 3.6.0 and JPA 2.0 and I'm having some troubles.
I get InvalidClassException on some queries. By the way I'm using metamodel with hibernate-jpamodelgen.
I.e. one below runs fine:
Code:
CriteriaBuilder cb = getCriteriaBuilder();
CriteriaQuery<UserEntity> cq = getCriteriaQuery(cb);
cq.where(cb.equal(cq.from(UserEntity.class).get(UserEntity_.username), username));
but with this one I'm having trouble:
Code:
CriteriaBuilder cb = getCriteriaBuilder();
CriteriaQuery<UserGroup> cq = getCriteriaQuery(cb);
cq.where(cb.equal(cq.from(UserGroup.class).join(UserGroup_.entries).join(UserGroupEntry_.user).get(UserEntity_.id), user.getId()));
I get exception like below.
All classes used in query implements Serializable.
I'm kinda lost here so any help would be appreciated.
Code:
java.io.InvalidClassException: com.ptm.model.BaseEntity; local class incompatible: stream classdesc serialVersionUID = 7662749495871325837, local class serialVersionUID = 8176072949097236524
at java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:579)
at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1600)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1513)
at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1600)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1513)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1749)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1346)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:368)
at org.hibernate.util.SerializationHelper.doDeserialize(SerializationHelper.java:244)
at org.hibernate.util.SerializationHelper.deserialize(SerializationHelper.java:306)
at org.hibernate.type.descriptor.java.SerializableTypeDescriptor.fromBytes(SerializableTypeDescriptor.java:130)
at org.hibernate.type.descriptor.java.SerializableTypeDescriptor.wrap(SerializableTypeDescriptor.java:116)
at org.hibernate.type.descriptor.java.SerializableTypeDescriptor.wrap(SerializableTypeDescriptor.java:39)
at org.hibernate.type.descriptor.sql.VarbinaryTypeDescriptor$2.doExtract(VarbinaryTypeDescriptor.java:62)
at org.hibernate.type.descriptor.sql.BasicExtractor.extract(BasicExtractor.java:64)
at org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:253)
at org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:249)