我得到了第二行的错误。
qlString = "select r FROM Hotspot r "
+ " left outer join fetch r.G1 g1 "
+ " left outer join fetch r.G2 g2 "
+ " left outer join fetch r.G3 g3 "
+ " left outer join fetch r.G4 g4 "
+ " left outer join fetch r.G5 g5 "
+" join r.A a "
+" left outer join fetch r.FR rm "
+ "where a.id= :aId";
query = session.createQuery(qlString);
query.setParameter("aId",lid);
hpts =(List<Hotspot>)query.list();
这是我的hibernate实体类。
@Entity
@Table(name="HOTSPOT")
@NamedQuery(name="Hotspot.findAll", query="SELECT f FROM Hotspot f")
public class Hotspot implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@SequenceGenerator(name="HOTSPOT_ID_GENERATOR", sequenceName="HOTSPOT_SEQ")
@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="HOTSPOT_ID_GENERATOR")
private long id;
这是部分堆栈跟踪
org.hibernate.type.SerializationException: could not deserialize
at org.hibernate.internal.util.SerializationHelper.doDeserialize(SerializationHelper.java:243)
at org.hibernate.internal.util.SerializationHelper.deserialize(SerializationHelper.java:287)
at org.hibernate.type.descriptor.java.SerializableTypeDescriptor.fromBytes(SerializableTypeDescriptor.java:138)
at org.hibernate.type.descriptor.java.SerializableTypeDescriptor.wrap(SerializableTypeDescriptor.java:113)
at org.hibernate.type.descriptor.java.SerializableTypeDescriptor.wrap(SerializableTypeDescriptor.java:27)
at org.hibernate.type.descriptor.sql.VarbinaryTypeDescriptor$2.doExtract(VarbinaryTypeDescriptor.java:53)
休眠版本
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>5.0.1.Final</version>
</dependency>
编辑:用hibernate版本和query更新了问题。
1条答案
按热度按时间bxjv4tth1#
您没有显示整个Map,但是看起来您正在使用一个不受支持的java类类型作为hibernate试图通过java反序列化机制反序列化的属性,但是它失败了,因为数据显然不是有效的java序列化流。
我猜你忘了把
@Entity
或者@Embeddable
在某个类上,某个类未被扫描,或者您忘记在persistence.xml中注册它。