Hi , when i try to use this entity as shown below: package persistence.jpa.models; import javax.jdo.annotations.Indices; import javax.persistence.*; import java.io.Serializable; import java.sql.Date; import java.util.Objects; @Entity @Table(name = "usrlist", schema = "posts") @NamedQueries( { @NamedQuery(name = "UsrListEntity.clearAllIds" , query = "UPDATE UsrlistEntity usrlist SET usrlist.dyId = -1"), } ) @Indices( { @javax.jdo.annotations.Index(members = {"id","pwd","access"}) } ) public class UsrlistEntity implements Serializable { private static final long serialVersionUID = -4472890635861972890L; private int id; private int dyId; private long pwd; private String usrName; private Integer mail; private int access; private short programType; private Date regDate; private Date regEnd; private Date lastLogin; private String lastIp; private int flags; private String name; private String surname; private String job; private String phoneNumber; private Long contactHash; private String kadrosu; private String buroGruplama; private Long groupsHash; @Id @Column(name = "id") public int getId() { return id; } public void setId(int id) { this.id = id; } @Basic @Column(name = "dy_id") public int getDyId() { return dyId; } public void setDyId(int dyId) { this.dyId = dyId; } @Basic @Column(name = "pwd") public long getPwd() { return pwd; } public void setPwd(long pwd) { this.pwd = pwd; } @Basic @Column(name = "usr_name") public String getUsrName() { return usrName; } public void setUsrName(String usrName) { this.usrName = usrName; } @Basic @Column(name = "mail") public Integer getMail() { return mail; } public void setMail(Integer mail) { this.mail = mail; } @Basic @Column(name = "access") public int getAccess() { return access; } public void setAccess(int access) { this.access = access; } @Basic @Column(name = "program_type") public short getProgramType() { return programType; } public void setProgramType(short programType) { this.programType = programType; } @Basic @Column(name = "reg_date") public Date getRegDate() { return regDate; } public void setRegDate(Date regDate) { this.regDate = regDate; } @Basic @Column(name = "reg_end") public Date getRegEnd() { return regEnd; } public void setRegEnd(Date regEnd) { this.regEnd = regEnd; } @Basic @Column(name = "last_login") public Date getLastLogin() { return lastLogin; } public void setLastLogin(Date lastLogin) { this.lastLogin = lastLogin; } @Basic @Column(name = "last_ip") public String getLastIp() { return lastIp; } public void setLastIp(String lastIp) { this.lastIp = lastIp; } @Basic @Column(name = "flags") public int getFlags() { return flags; } public void setFlags(int flags) { this.flags = flags; } @Basic @Column(name = "name") public String getName() { return name; } public void setName(String name) { this.name = name; } @Basic @Column(name = "surname") public String getSurname() { return surname; } public void setSurname(String surname) { this.surname = surname; } @Basic @Column(name = "job") public String getJob() { return job; } public void setJob(String job) { this.job = job; } @Basic @Column(name = "phoneNumber") public String getPhoneNumber() { return phoneNumber; } public void setPhoneNumber(String phoneNumber) { this.phoneNumber = phoneNumber; } @Basic @Column(name = "contactHash") public Long getContactHash() { return contactHash; } public void setContactHash(Long contactHash) { this.contactHash = contactHash; } @Basic @Column(name = "kadrosu") public String getKadrosu() { return kadrosu; } public void setKadrosu(String kadrosu) { this.kadrosu = kadrosu; } @Basic @Column(name = "buroGruplama") public String getBuroGruplama() { return buroGruplama; } public void setBuroGruplama(String buroGruplama) { this.buroGruplama = buroGruplama; } @Basic @Column(name = "groupsHash") public Long getGroupsHash() { return groupsHash; } public void setGroupsHash(Long groupsHash) { this.groupsHash = groupsHash; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; UsrlistEntity that = (UsrlistEntity) o; return id == that.id && dyId == that.dyId && pwd == that.pwd && access == that.access && programType == that.programType && flags == that.flags && Objects.equals(usrName, that.usrName) && Objects.equals(mail, that.mail) && Objects.equals(regDate, that.regDate) && Objects.equals(regEnd, that.regEnd) && Objects.equals(lastLogin, that.lastLogin) && Objects.equals(lastIp, that.lastIp) && Objects.equals(name, that.name) && Objects.equals(surname, that.surname) && Objects.equals(job, that.job) && Objects.equals(phoneNumber, that.phoneNumber) && Objects.equals(contactHash, that.contactHash) && Objects.equals(kadrosu, that.kadrosu) && Objects.equals(buroGruplama, that.buroGruplama) && Objects.equals(groupsHash, that.groupsHash); } @Override public int hashCode() { return Objects.hash(id, dyId, pwd, usrName, mail, access, programType, regDate, regEnd, lastLogin, lastIp, flags, name, surname, job, phoneNumber, contactHash, kadrosu, buroGruplama, groupsHash); } }
On the second class.I try to use this entity like shown below;
@Override public Triplet<Integer, Long, Long> login(int gid, long id, long password, String ipAddr) { try { final UsrlistEntity usrlistEntity = entityManager.find(UsrlistEntity.class, gid); // << Exception thrown here if (usrlistEntity == null) { return null; } if (usrlistEntity.getPwd() == password) { return new Triplet<Integer, Long, Long>(1, usrlistEntity.getContactHash(), usrlistEntity.getGroupsHash()); } return null; } catch (PersistenceException e) { e.printStackTrace(); } return null; }
[ObjectDB 2.7.5_01] javax.persistence.PersistenceException
Invalid index path 'id' in type persistence.jpa.models.UsrlistEntity (error 328)
at com.objectdb.jpa.EMImpl.find(EMImpl.java:603)
at com.objectdb.jpa.EMImpl.find(EMImpl.java:518)
at persistence.jpa.PersistenceJPALogin.login(PersistenceJPALogin.java:33)
at server.dbcommandhandlers.core.LoginDBHandler.execute(LoginDBHandler.java:128)
at server.db.BasicDBUnit.run(BasicDBUnit.java:206)
at java.lang.Thread.run(Thread.java:748)
Caused by: com.objectdb.o.UserException: Invalid index path 'id' in type persistence.jpa.models.UsrlistEntity
at com.objectdb.o.MSG.a(MSG.java:64)
at com.objectdb.o.IXN.i(IXN.java:458)
at com.objectdb.o.IXN.a(IXN.java:277)
at com.objectdb.o.IXN.<init>(IXN.java:176)
at com.objectdb.o.UTY.A(UTY.java:760)
at com.objectdb.o.TYS.h(TYS.java:791)
at com.objectdb.o.TYS.e(TYS.java:641)
at com.objectdb.o.TYS.ZJ(TYS.java:593)
at com.objectdb.o.TYM.Y(TYM.java:554)
at com.objectdb.o.TYM.j(TYM.java:489)
at com.objectdb.o.TYM.R(TYM.java:823)
at com.objectdb.o.OBC.am(OBC.java:715)
at com.objectdb.jpa.EMImpl.find(EMImpl.java:581)
... 5 more
How to solve this issue ?