我通过JPADAO扩展获得了DAO类:
public class ChildClassDAO extends GDAO<ChildClass, Long>
GDAO实现就是这样:
public abstract class JpaDAO<E,K> implements DAO<E,K>
findById是这样的:
public E findById(K id) { return (E) entityManager.find(entityClass, id); }
ChildClass id声明为:
@Id
@SequenceGenerator(name="CHILD_CLASS_GEN", sequenceName="SEQ_CHILDCLASS")
@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="CHILD_CLASS_GEN")
private long code;
当我在此ChildClass中使用实现时:
ChildClassDAO dao = new ChildClassDAO(em);
ChildClass child = dao.findById(idCode);
返回此错误;但在其他实现中效果很好:
GenericJDBCException: Could not read entity state from ResultSet : EntityKey[com.test.ChildClass #1]
有人可以帮助我发现我的错误吗?