java - Stackoverflow while deleting an entity -
i using eclipse link , want delete entities clause. when doing stackoverflow error. here method use deleteting. wrong in ?
entitymanager em = getentitymanager(); try { aclentry acle = new aclentry(); typedquery<aclentry> q = em.createquery("delete aclentry acle acle.acl=:acl ", aclentry.class); q.setparameter("acl", acl); } catch (exception ex) { log.throwing("dao", "removeallaclentries", ex); // em.gettransaction().rollback(); } { em.close(); } }
here aclenrty entity:
/* * change license header, choose license headers in project properties. * change template file, choose tools | templates * , open template in editor. */ package com.cisco.onepk_web.entity; import java.io.serializable; import java.util.objects; import javax.persistence.entity; import javax.persistence.generatedvalue; import javax.persistence.generationtype; import javax.persistence.id; import javax.persistence.manytoone; import javax.persistence.sequencegenerator; /** * * @author abondar */ @entity @sequencegenerator(name = "acle_seq", sequencename = "acle_seq", initialvalue = 1, allocationsize=1) public class aclentry implements serializable { private static final long serialversionuid = 1l; @generatedvalue(strategy = generationtype.auto, generator="acle_seq") @id private long id; @manytoone(targetentity = acl.class) private acl acl; private integer seqnumber; private string action; private string protocol; private string srcaddr; private string dstaddr; private string srcwcard; private string dstwcard; private integer srcport; private integer dstport; public long getid() { return id; } public void setid(long id) { this.id = id; } public acl getacl() { return acl; } public void setacl(acl acl) { this.acl = acl; } public integer getseqnumber() { return seqnumber; } public void setseqnumber(integer seqnumber) { this.seqnumber = seqnumber; } public string getprotocol() { return protocol; } public void setprotocol(string protocol) { this.protocol = protocol; } public string getsrcaddr() { return srcaddr; } public void setsrcaddr(string srcaddr) { this.srcaddr = srcaddr; } public string getdstaddr() { return dstaddr; } public void setdstaddr(string dstaddr) { this.dstaddr = dstaddr; } public string getsrcwcard() { return srcwcard; } public void setsrcwcard(string srcwcard) { this.srcwcard = srcwcard; } public string getdstwcard() { return dstwcard; } public void setdstwcard(string dstwcard) { this.dstwcard = dstwcard; } public integer getsrcport() { return srcport; } public void setsrcport(integer srcport) { this.srcport = srcport; } public integer getdstport() { return dstport; } public void setdstport(integer dstport) { this.dstport = dstport; } public string getaction() { return action; } public void setaction(string action) { this.action = action; } @override public int hashcode() { int hash = 5; hash = 67 * hash + objects.hashcode(this.id); hash = 67 * hash + objects.hashcode(this.acl); hash = 67 * hash + objects.hashcode(this.seqnumber); hash = 67 * hash + objects.hashcode(this.action); hash = 67 * hash + objects.hashcode(this.protocol); hash = 67 * hash + objects.hashcode(this.srcaddr); hash = 67 * hash + objects.hashcode(this.dstaddr); hash = 67 * hash + objects.hashcode(this.srcwcard); hash = 67 * hash + objects.hashcode(this.dstwcard); hash = 67 * hash + objects.hashcode(this.srcport); hash = 67 * hash + objects.hashcode(this.dstport); return hash; } @override public boolean equals(object obj) { if (obj == null) { return false; } if (getclass() != obj.getclass()) { return false; } final aclentry other = (aclentry) obj; if (!objects.equals(this.id, other.id)) { return false; } if (!objects.equals(this.acl, other.acl)) { return false; } if (!objects.equals(this.seqnumber, other.seqnumber)) { return false; } if (!objects.equals(this.action, other.action)) { return false; } if (!objects.equals(this.protocol, other.protocol)) { return false; } if (!objects.equals(this.srcaddr, other.srcaddr)) { return false; } if (!objects.equals(this.dstaddr, other.dstaddr)) { return false; } if (!objects.equals(this.srcwcard, other.srcwcard)) { return false; } if (!objects.equals(this.dstwcard, other.dstwcard)) { return false; } if (!objects.equals(this.srcport, other.srcport)) { return false; } if (!objects.equals(this.dstport, other.dstport)) { return false; } return true; } @override public string tostring() { return "aclentry{" + "id=" + id + ", acl=" + acl + ", seqnumber=" + seqnumber + ", action=" + action + ", protocol=" + protocol + ", srcaddr=" + srcaddr + ", dstaddr=" + dstaddr + ", srcwcard=" + srcwcard + ", dstwcard=" + dstwcard + ", srcport=" + srcport + ", dstport=" + dstport + '}'; } }
Comments
Post a Comment