Caused by: org.hibernate.type.SerializationException: could not deserialize
at org.hibernate.internal.util.SerializationHelper.doDeserialize(SerializationHelper.java:262)
at org.hibernate.internal.util.SerializationHelper.deserialize(SerializationHelper.java:306)
at org.hibernate.type.descriptor.java.SerializableTypeDescriptor.fromBytes(SerializableTypeDescriptor.java:155)
at org.hibernate.type.descriptor.java.SerializableTypeDescriptor.wrap(SerializableTypeDescriptor.java:130)
at org.hibernate.type.descriptor.java.SerializableTypeDescriptor.wrap(SerializableTypeDescriptor.java:44)
at org.hibernate.type.descriptor.sql.VarbinaryTypeDescriptor$2.doExtract(VarbinaryTypeDescriptor.java:71)
at org.hibernate.type.descriptor.sql.BasicExtractor.extract(BasicExtractor.java:64)
at org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:263)
at org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:259)
at org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:249)
at org.hibernate.type.AbstractStandardBasicType.hydrate(AbstractStandardBasicType.java:334)
at org.hibernate.loader.Loader.extractKeysFromResultSet(Loader.java:784)
at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:720)
at org.hibernate.loader.Loader.processResultSet(Loader.java:952)
at org.hibernate.loader.Loader.doQuery(Loader.java:920)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:354)
at org.hibernate.loader.Loader.doList(Loader.java:2551)
at org.hibernate.loader.Loader.doList(Loader.java:2537)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2367)
at org.hibernate.loader.Loader.list(Loader.java:2362)
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:496)
at org.hibernate.hql.internal.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:387)
at org.hibernate.engine.query.spi.HQLQueryPlan.performList(HQLQueryPlan.java:229)
at org.hibernate.internal.SessionImpl.list(SessionImpl.java:1260)
at org.hibernate.internal.QueryImpl.list(QueryImpl.java:103)
at org.springframework.orm.hibernate4.HibernateTemplate$29.doInHibernate(HibernateTemplate.java:875)
at org.springframework.orm.hibernate4.HibernateTemplate$29.doInHibernate(HibernateTemplate.java:864)
at org.springframework.orm.hibernate4.HibernateTemplate.doExecute(HibernateTemplate.java:340)
... 59 more
Caused by: java.io.EOFException
at java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2325)
at java.io.ObjectInputStream$BlockDataInputStream.readShort(ObjectInputStream.java:2794)
at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:801)
at java.io.ObjectInputStream.<init>(ObjectInputStream.java:299)
at org.hibernate.internal.util.SerializationHelper$CustomObjectInputStream.<init>(SerializationHelper.java:328)
at org.hibernate.internal.util.SerializationHelper$CustomObjectInputStream.<init>(SerializationHelper.java:318)
at org.hibernate.internal.util.SerializationHelper.doDeserialize(SerializationHelper.java:237)
... 86 more
获取上述异常。
以下是上课。
@Entity
@Table(name = "USERS")
public class User implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "USER_ID", nullable = false)
private Number userId;
@Column(name = "USER_NAME", nullable = true)
private String userName;
@ManyToOne
@JoinColumn(name="CLIENT_ID", unique=false, nullable=true, insertable=true, updatable=true)
private Client client;
@Column(name = "PASSWORD", nullable = true)
private String password;
@Column(name = "PASSWORD_CREATION_DATE", nullable = false)
private Timestamp passwordCreationDate;
@Column(name = "SALT", nullable = true)
private String salt;
@Column(name = "ADDRESS_ID", nullable = false)
private Number addressId;
@Column(name = "FIRST_NAME", nullable = true)
private String firstName;
@Column(name = "LAST_NAME", nullable = true)
private String lastName;
@Column(name = "EMAIL" , nullable = true)
private String email;
@Column(name = "IS_MADE_UP_USER_NAME" , nullable = true)
private boolean isMadeUpUserName;
@Column(name = "CELL_PHONE" , nullable = true)
private Number cellPhone;
@Column(name = "LAST4SSN" , nullable = true)
private String last4SSN;
@Column(name = "LOCKED" , nullable = false)
private boolean locked;
@Column(name = "FAILED_LOGIN_COUNT" , nullable = true)
private Integer failedLoginCount;
@Column(name = "DATE_CREATED" , nullable = false)
private Timestamp dateCreated;
@Column(name = "DATE_MODIFIED" , nullable = true)
private Timestamp dateModified;
@Column(name = "CREATED_BY_ID" , nullable = true)
private Number createdBy;
@Column(name = "MODIFIED_BY_ID" , nullable = true)
private Number modifiedBy;
@Column(name = "TIME_ZONE" , nullable = true)
private String timeZone;
@Column(name = "LANGUAGE" , nullable = true)
private String language;
@Column(name = "USER_ENTERED_TEL" , nullable = true)
private Number userEnteredTel;
@Column(name = "DO_NOT_NOTIFY" , nullable = true)
private boolean doNotNotify;
enter code here
@Column(name = "DISABLED" , nullable = true)
private boolean disabled;
@Column(name = "TERMS_CONFIRMED" , nullable = true)
private boolean termsConfirmed;
我不知道我错了,请帮我解决以上问题。 得到反序列化异常。由于这个desialixation导致eof异常。上述类中的错误。
以下是表格结构
`user_id` int(11) NOT NULL AUTO_INCREMENT,
`user_name` varchar(50) CHARACTER SET utf8 DEFAULT NULL,
`Password` varchar(256) DEFAULT NULL,
`password_creation_date` datetime DEFAULT NULL,
`salt` varchar(50) DEFAULT NULL,
`address_id` decimal(10,0) NOT NULL,
`client_id` int(11) DEFAULT NULL,
`first_name` varchar(100) DEFAULT NULL,
`last_name` varchar(100) DEFAULT NULL,
`email` varchar(100) DEFAULT NULL,
`is_made_up_user_name` tinyint(1) DEFAULT '0',
`cell_phone` decimal(10,0) DEFAULT NULL,
`dob` varchar(45) DEFAULT NULL,
`last4ssn` varchar(45) DEFAULT NULL,
`locked` tinyint(1) NOT NULL,
`disabled` tinyint(1) DEFAULT '0',
`failed_login_count` int(11) DEFAULT NULL,
`date_created` date NOT NULL,
`date_modified` date DEFAULT NULL,
`created_by_id` decimal(10,0) DEFAULT NULL,
`modified_by_id` decimal(10,0) DEFAULT NULL,
`time_zone` varchar(256) DEFAULT NULL,
`language` varchar(256) DEFAULT NULL,
`user_entered_tel` decimal(10,0) DEFAULT NULL,
`do_not_notify` tinyint(1) DEFAULT '1',
`terms_confirmed` tinyint(1) DEFAULT '0',
PRIMARY KEY (`user_id`),
UNIQUE KEY `user_name` (`user_name`),
KEY `client_id` (`client_id`),
CONSTRAINT `USERS_ibfk_1` FOREIGN KEY (`client_id`)
REFERENCES `client` (`client_id`)
答案 0 :(得分:0)
EntityManager
)注释掉可能导致此问题的关键部分,例如任何实体参考:
//@ManyToOne
//@JoinColumn(name="CLIENT_ID", unique=false, nullable=true, insertable=true,
// updatable=true)
//private Client client;
现在检查&#39;客户端&#39; class,它没有引用任何其他实体和在上面用最基本的设置评论,例如
@ManyToOne
@JoinColumn(name="CLIENT_ID")
private Client client;
现在你应该接近导致问题的声明
您应该还启用hibernate sql日志记录和参数日志记录以查看下面的内容。
我在类似的设置上遇到了同样的错误,而是由于错误的建模/摆弄注释和关系导致帮助了我out:http://levelup.lishman.com/hibernate/associations/many-to-one.php