Dear all,
i am facing this problem while trying to insert and retrieve at the same
time from one table simultaneously.
this is the error i am getting
openjpa.Query - Thi
s query on type "class
com.symcor.pcbi.dal.ejb3.entity.fraudlink.bns.VCSData" mu
st load the entire candidate class extent and evaluate the query in-memory.
Thi
s may be very slow. The query must be executed in memory because OpenJPA is
con
figured with IgnoreCache=false and FlushBeforeQueries=false and there are
dirty
instances that may affect the query's outcome in the cache.
11:02:30,655 ERROR [OpenEJB] The bean instances business method encountered
a sy
stem exception: Cannot manipulate identity of type "com.ejb3.ent
ity.VCSDataPK": it's identity type is unknown.
<1.0.0-r561970-r561970 nonfatal user error>
org.apache.openjpa.persistence.Argum
entException: Cannot manipulate identity of type "com.ejb3.entit
y.VCSDataPK": it's identity type is unknown.
my Entity Class is VCSData and VcsdataPk is the composite primary key.
here is the entity class
VCsData
*/
@Entity(name = "vcsdata")
@Table(name = "VCSDATA")
@NamedQueries({
@NamedQuery(name = "vcsdata.getAllRecords",
query = "SELECT a FROM vcsdata a")
})
public class VCSData implements Serializable {
private static final long serialVersionUID = 1L;
@EmbeddedId
//private VCSDataPK primaryKey = null;
private VCSDataPK primaryKey;
/**
* A constant from Java Constants file.
*/
@Column(name = "PRODUCTID")
private double productId;
/**
* Query VCSTRANSACTIONINFO table based on SourceId. SourceId is a
constant
from java Constants file. A constant referenced from table
VCSTRANSACTIONINFO.VCSTRANSACTIONID
*/
@Column(name = "TRANSACTIONID")
private double transactionId;
/**
* Query VCSTRANSACTIONINFO table based on SourceId. SourceId is a
constant
from java Constants file. A constant referenced from table
VCSTRANSACTIONINFO.BILLING_CATEGORY
*/
@Column(name = "BILLING_CATEGORY")
private double billing_category;
/**
* A constant from Java Constants file.
*/
@Column(name = "SOURCEID")
private double sourceId;
/**
* A constant from Java Constants file.
*/
@Column(name = "UOM")
private double uom;
/**
* Total count of records in the I/P file (bulk file or FL I/p file).
Calculated at run time.
*/
@Column(name = "BILLINGTOTAL")
private double billingTotal;
/**
* blank
*/
@Column(name = "ADDITIONALINFO1")
private String additionalinfo1;
/**
* blank
*/
@Column(name = "ADDITIONALINFO2")
private String additionalinfo2;
/**
* blank
*/
@Column(name = "ADDITIONALINFO3")
private String additionalinfo3;
/**
* @return the processingDate
*/
public VCSDataPK getPrimaryKey() {
return this.primaryKey;
}
public void setPrimaryKey(VCSDataPK pk) {
this.primaryKey = pk;
}
/**
* @return the productId
*/
public double getProductId() {
return productId;
}
/**
* @param productId the productId to set
*/
public void setProductId(double productId) {
this.productId = productId;
}
/**
* @return the transactionId
*/
public double getTransactionId() {
return transactionId;
}
/**
* @param transactionId the transactionId to set
*/
public void setTransactionId(double transactionId) {
this.transactionId = transactionId;
}
/**
* @return the billing_category
*/
public double getBilling_category() {
return billing_category;
}
/**
* @param billing_category the billing_category to set
*/
public void setBilling_category(double billing_category) {
this.billing_category = billing_category;
}
/**
* @return the sourceId
*/
public double getSourceId() {
return sourceId;
}
/**
* @param sourceId the sourceId to set
*/
public void setSourceId(double sourceId) {
this.sourceId = sourceId;
}
/**
* @return the uom
*/
public double getUom() {
return uom;
}
/**
* @param uom the uom to set
*/
public void setUom(double uom) {
this.uom = uom;
}
/**
* @return the billingTotal
*/
public double getBillingTotal() {
return billingTotal;
}
/**
* @param billingTotal the billingTotal to set
*/
public void setBillingTotal(double billingTotal) {
this.billingTotal = billingTotal;
}
/**
* @return the additionalinfo1
*/
public String getAdditionalinfo1() {
return additionalinfo1;
}
/**
* @param additionalinfo1 the additionalinfo1 to set
*/
public void setAdditionalinfo1(String additionalinfo1) {
this.additionalinfo1 = additionalinfo1;
}
/**
* @return the additionalinfo2
*/
public String getAdditionalinfo2() {
return additionalinfo2;
}
/**
* @param additionalinfo2 the additionalinfo2 to set
*/
public void setAdditionalinfo2(String additionalinfo2) {
this.additionalinfo2 = additionalinfo2;
}
/**
* @return the additionalinfo3
*/
public String getAdditionalinfo3() {
return additionalinfo3;
}
/**
* @param additionalinfo3 the additionalinfo3 to set
*/
public void setAdditionalinfo3(String additionalinfo3) {
this.additionalinfo3 = additionalinfo3;
}
/**
* Default Constructor
*/
public VCSData() {
// TODO Auto-generated constructor stub
}
/**
* Parameterised constructor.
*
* @param to
* Transfer object.
*/
public VCSData(Object to) {
VCSDataData data = (VCSDataData) to;
VCSDataPK vcsDataPK = new VCSDataPK();
System.out.println("***** START : VCSData(Object) *******" +
data.getProcessingDate());
vcsDataPK.setProcessingDate(data.getProcessingDate());
vcsDataPK.setClientID(data.getClientID());
vcsDataPK.setInterfaceId(data.getInterfaceId());
vcsDataPK.setSiteId(data.getSiteId());
this.setPrimaryKey(vcsDataPK);
System.out.println("***** START : VCSData(Object) *******" +
data.getProcessingDate());
System.out.println("***** 111 : VCSData(Object) *******" );
//getPrimaryKey().setClientID(data.getClientID());
System.out.println("***** 222 : VCSData(Object) *******" );
//getPrimaryKey().setInterfaceId(data.getInterfaceId());
System.out.println("***** 333 : VCSData(Object) *******" );
//getPrimaryKey().setSiteId(data.getSiteId());
System.out.println("***** MIDDLE : VCSData(Object) *******" );
setProductId(data.getProductId());
setTransactionId(data.getTransactionId());
setBilling_category(data.getBilling_category());
setSourceId(data.getSourceId());
setUom(data.getUom());
setBillingTotal(data.getBillingTotal() );
setAdditionalinfo1(data.getAdditionalinfo1());
setAdditionalinfo2(data.getAdditionalinfo2());
setAdditionalinfo3(data.getAdditionalinfo3());
System.out.println("***** END : VCSData(Object) *******" +
getPrimaryKey());
}
/**
* Is entity the same as this entity?
*
* @param entity:
* the entity being compared
* @return: true if entity being compared is the same as this entity
*/
public boolean sameEntity(Object entity) {
return (entity != null && (entity instanceof VCSData || entity
instanceof
VCSDataData));
}
/**
* Converts a collection of JPA (VCSData) objects to a collection of
* corresponding TO objects (VCSDataData).
*
* @param jpa
* a collection of JPA objects
* @return a collection of corresponding TO objects
*/
@SuppressWarnings("unchecked")
public final Collection converter(Collection jpa) {
Collection result = new ArrayList();
Iterator it = jpa.iterator();
System.out.println("START : converter() **** ");
while (it.hasNext()) {
VCSData objset = (VCSData) it.next();
VCSDataData data = new VCSDataData();
data.setProductId(objset.getProductId());
data.setTransactionId(objset.getTransactionId());
data.setBilling_category(objset.getBilling_category());
data.setSourceId(objset.getSourceId());
data.setUom(objset.getUom());
data.setBillingTotal(objset.getBillingTotal() );
data.setAdditionalinfo1(objset.getAdditionalinfo1());
data.setAdditionalinfo2(objset.getAdditionalinfo2());
data.setAdditionalinfo3(objset.getAdditionalinfo3());
data.setProcessingDate(objset.getPrimaryKey().getProcessingDate());
data.setClientID(objset.getPrimaryKey().getClientID());
data.setInterfaceId(objset.getPrimaryKey().getInterfaceId());
data.setSiteId(objset.getPrimaryKey().getSiteId());
result.add(data);
}
return result;
}
}
here is the primary key class
@Embeddable
public class VCSDataPK implements Serializable {
/**
* Composit key columns.
*/
private static final long serialVersionUID = 1L;
@Column(name="PROCESSINGDATE")
@Basic
@Temporal(TemporalType.DATE)
private Date processingDate;
@Column(name="CLIENTID")
private Short clientID;
@Column(name="INTERFACEID")
private double interfaceId;
@Column(name="SITEID")
private String siteId ;
/** default constructor */
public VCSDataPK() {
}
public Date getProcessingDate() {
System.out.println("***** VCSDataPK : Date getProcessingDate()
***************");
return processingDate;
}
public void setProcessingDate(Date processingDate) {
this.processingDate = processingDate;
}
public Short getClientID() {
return clientID;
}
public void setClientID(Short clientID) {
this.clientID = clientID;
}
public double getInterfaceId() {
return interfaceId;
}
public void setInterfaceId(double interfaceId) {
this.interfaceId = interfaceId;
}
public String getSiteId() {
return siteId;
}
public void setSiteId(String siteId) {
this.siteId = siteId;
}
/* (non-Javadoc)
* @see java.lang.Object#hashCode()
*/
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result
+ ((clientID == null) ? 0 :
clientID.hashCode());
long temp;
temp = Double.doubleToLongBits(interfaceId);
result = prime * result + (int) (temp ^ (temp >>> 32));
result = prime * result
+ ((processingDate == null) ? 0 :
processingDate.hashCode());
result = prime * result + ((siteId == null) ? 0 :
siteId.hashCode());
return result;
}
/* (non-Javadoc)
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (!(obj instanceof VCSDataPK))
return false;
final VCSDataPK other = (VCSDataPK) obj;
if (clientID == null) {
if (other.clientID != null)
return false;
} else if (!clientID.equals(other.clientID))
return false;
if (Double.doubleToLongBits(interfaceId) != Double
.doubleToLongBits(other.interfaceId))
return false;
if (processingDate == null) {
if (other.processingDate != null)
return false;
} else if (!processingDate.equals(other.processingDate))
return false;
if (siteId == null) {
if (other.siteId != null)
return false;
} else if (!siteId.equals(other.siteId))
return false;
return true;
}
}
this method i use for insertion
this.insertVCSData();
this is the method for retrieval
vcsDataData1 = this.getVCSData(Dbdate);
for retrieving i am using the named query specified in the entity class
please help
--
View this message in context:
http://n2.nabble.com/open-jpa-problem.-tp1560668p1560668.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.