【发布时间】:2013-03-29 00:54:30
【问题描述】:
我在 GAE 中处理会话时遇到了困难。我正在尝试在会话中存储两个类和一个字符串。尽管在 DEV 环境中它运行良好,但在生产中,一个类和一个字符串不会在会话中持续存在。未保存为会话属性的类如下:
@PersistenceCapable(detachable="true")
public class Agent implements Serializable{
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
private Long id;
@Persistent private String name; //Name of the Agency
@Element(dependent = "true")
private List<Contact> contacts = new ArrayList<Contact>();
@Element(dependent = "true")
private List<Agency> agencies = new ArrayList<Agency>();
@Persistent private List<Long> subAgents = new ArrayList<Long>();
@Persistent private Date createdOn = new Date();
}
我想再次提一下,它在 DEV 环境中运行良好,但在生产环境中我得到的值为 null。如您所见,我已经使该类实现了可序列化。但我认为这不是问题,因为我将另外一个属性设置为一个简单的字符串并且这也失败了(我将属性值设为空)。然而,会话是创建的,因为我可以在后端看到它,并且还有一个类在会话中持久化。
有人有建议吗?提前致谢。
【问题讨论】: