Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » Internal Exception: java.lang.NoSuchFieldException
Internal Exception: java.lang.NoSuchFieldException [message #875452] Tue, 22 May 2012 19:23 Go to next message
v godara is currently offline v godaraFriend
Messages: 1
Registered: May 2012
Junior Member
i have a java app that displays data from a table called ScripMaster using jpa. i wish to add an extra field to my table but, when i add the extra field named 'holdValue' to my database table ScripMaster i get following exception, when i remove the field, the app works fine
Exception [EclipseLink-0] (Eclipse Persistence Services - 2.3.0.v20110604-r9504): org.eclipse.persistence.exceptions.IntegrityException
Descriptor Exceptions:
---------------------------------------------------------
Exception [EclipseLink-59] (Eclipse Persistence Services - 2.3.0.v20110604-r9504): org.eclipse.persistence.exceptions.DescriptorException
Exception Description: The instance variable [lastTradeDate] is not defined in the domain class [entity.ScripMaster], or it is not accessible.
Internal Exception: java.lang.NoSuchFieldException: lastTradeDate
Mapping: org.eclipse.persistence.mappings.DirectToFieldMapping[lastTradeDate-->StockCommodityDB.ScripMaster.LastTradeDate]
Descriptor: RelationalDescriptor(entity.ScripMaster --> [DatabaseTable(StockCommodityDB.ScripMaster)])
Exception [EclipseLink-59] (Eclipse Persistence Services - 2.3.0.v20110604-r9504): org.eclipse.persistence.exceptions.DescriptorException
Exception Description: The instance variable [holdValue] is not defined in the domain class [entity.ScripMaster], or it is not accessible.
Internal Exception: java.lang.NoSuchFieldException: holdValue

my entity class is as follows:

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package entity;

import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
*
* @author root
*/
@Entity
@Table(name = "ScripMaster", catalog = "StockCommodityDB", schema = "")
@XmlRootElement
@NamedQueries({
@NamedQuery(name = "ScripMaster.findAll", query = "SELECT s FROM ScripMaster s"),
@NamedQuery(name = "ScripMaster.findByScripID", query = "SELECT s FROM ScripMaster s WHERE s.scripID = :scripID"),
@NamedQuery(name = "ScripMaster.findByScripSymbol", query = "SELECT s FROM ScripMaster s WHERE s.scripSymbol = :scripSymbol"),
@NamedQuery(name = "ScripMaster.findByType", query = "SELECT s FROM ScripMaster s WHERE s.type = :type"),
@NamedQuery(name = "ScripMaster.findByCompanyName", query = "SELECT s FROM ScripMaster s WHERE s.companyName = :companyName"),
@NamedQuery(name = "ScripMaster.findByLastTradedPrice", query = "SELECT s FROM ScripMaster s WHERE s.lastTradedPrice = :lastTradedPrice"),
@NamedQuery(name = "ScripMaster.findByLastTradedQuantity", query = "SELECT s FROM ScripMaster s WHERE s.lastTradedQuantity = :lastTradedQuantity"),
@NamedQuery(name = "ScripMaster.findByOpenPrice", query = "SELECT s FROM ScripMaster s WHERE s.openPrice = :openPrice"),
@NamedQuery(name = "ScripMaster.findByHighPrice", query = "SELECT s FROM ScripMaster s WHERE s.highPrice = :highPrice"),
@NamedQuery(name = "ScripMaster.findByLowPrice", query = "SELECT s FROM ScripMaster s WHERE s.lowPrice = :lowPrice"),
@NamedQuery(name = "ScripMaster.findByTotalTradedQuantity", query = "SELECT s FROM ScripMaster s WHERE s.totalTradedQuantity = :totalTradedQuantity"),
@NamedQuery(name = "ScripMaster.findByTotalTradedVolume", query = "SELECT s FROM ScripMaster s WHERE s.totalTradedVolume = :totalTradedVolume"),
@NamedQuery(name = "ScripMaster.findByExchange", query = "SELECT s FROM ScripMaster s WHERE s.exchange = :exchange"),
@NamedQuery(name = "ScripMaster.findByBrokerageCharge", query = "SELECT s FROM ScripMaster s WHERE s.brokerageCharge = :brokerageCharge"),
@NamedQuery(name = "ScripMaster.findByPreviousClose", query = "SELECT s FROM ScripMaster s WHERE s.previousClose = :previousClose"),
@NamedQuery(name = "ScripMaster.findByChnge", query = "SELECT s FROM ScripMaster s WHERE s.chnge = :chnge"),
@NamedQuery(name = "ScripMaster.findByChngePer", query = "SELECT s FROM ScripMaster s WHERE s.chngePer = :chngePer"),
@NamedQuery(name = "ScripMaster.findByHoldValue", query = "SELECT s FROM ScripMaster s WHERE s.holdValue = :holdValue"),
@NamedQuery(name = "ScripMaster.findByLastTradeDate", query = "SELECT s FROM ScripMaster s WHERE s.lastTradeDate = :lastTradeDate")})
public class ScripMaster implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@NotNull
@Column(name = "ScripID", nullable = false)
private Integer scripID;
@Size(max = 15)
@Column(name = "ScripSymbol", length = 15)
private String scripSymbol;
@Size(max = 10)
@Column(name = "Type", length = 10)
private String type;
@Size(max = 50)
@Column(name = "CompanyName", length = 50)
private String companyName;
// @Max(value=?) @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
@Column(name = "LastTradedPrice", precision = 22)
private Double lastTradedPrice;
@Column(name = "LastTradedQuantity")
private Integer lastTradedQuantity;
@Column(name = "OpenPrice", precision = 22)
private Double openPrice;
@Column(name = "HighPrice", precision = 22)
private Double highPrice;
@Column(name = "LowPrice", precision = 22)
private Double lowPrice;
@Column(name = "TotalTradedQuantity")
private Integer totalTradedQuantity;
@Column(name = "TotalTradedVolume")
private Integer totalTradedVolume;
@Size(max = 30)
@Column(name = "Exchange", length = 30)
private String exchange;
@Column(name = "BrokerageCharge", precision = 22)
private Double brokerageCharge;
@Column(name = "PreviousClose", precision = 22)
private Double previousClose;
@Column(name = "Chnge", precision = 22)
private Double chnge;
@Column(name = "ChngePer", precision = 22)
private Double chngePer;
@Column(name = "HoldValue", precision = 22)
private Double holdValue;
@Column(name = "LastTradeDate")
@Temporal(TemporalType.DATE)
private Date lastTradeDate;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "scripID", fetch = FetchType.EAGER)
private Collection<UserStock> userStockCollection;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "scripID", fetch = FetchType.EAGER)
private Collection<UserTrack> userTrackCollection;
@JoinColumn(name = "CommoditySubCategoryID", referencedColumnName = "CommoditySubCategoryID")
@ManyToOne(fetch = FetchType.EAGER)
private CommoditySubCategoryMaster commoditySubCategoryID;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "scripID", fetch = FetchType.EAGER)
private Collection<OrderStock> orderStockCollection;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "scripID", fetch = FetchType.EAGER)
private Collection<TradeStock> tradeStockCollection;

public ScripMaster() {
}

public ScripMaster(Integer scripID) {
this.scripID = scripID;
}

public Integer getScripID() {
return scripID;
}

public void setScripID(Integer scripID) {
this.scripID = scripID;
}

public String getScripSymbol() {
return scripSymbol;
}

public void setScripSymbol(String scripSymbol) {
this.scripSymbol = scripSymbol;
}

public String getType() {
return type;
}

public void setType(String type) {
this.type = type;
}

public String getCompanyName() {
return companyName;
}

public void setCompanyName(String companyName) {
this.companyName = companyName;
}

public Double getLastTradedPrice() {
return lastTradedPrice;
}

public void setLastTradedPrice(Double lastTradedPrice) {
this.lastTradedPrice = lastTradedPrice;
}

public Integer getLastTradedQuantity() {
return lastTradedQuantity;
}

public void setLastTradedQuantity(Integer lastTradedQuantity) {
this.lastTradedQuantity = lastTradedQuantity;
}

public Double getOpenPrice() {
return openPrice;
}

public void setOpenPrice(Double openPrice) {
this.openPrice = openPrice;
}

public Double getHighPrice() {
return highPrice;
}

public void setHighPrice(Double highPrice) {
this.highPrice = highPrice;
}

public Double getLowPrice() {
return lowPrice;
}

public void setLowPrice(Double lowPrice) {
this.lowPrice = lowPrice;
}

public Integer getTotalTradedQuantity() {
return totalTradedQuantity;
}

public void setTotalTradedQuantity(Integer totalTradedQuantity) {
this.totalTradedQuantity = totalTradedQuantity;
}

public Integer getTotalTradedVolume() {
return totalTradedVolume;
}

public void setTotalTradedVolume(Integer totalTradedVolume) {
this.totalTradedVolume = totalTradedVolume;
}

public String getExchange() {
return exchange;
}

public void setExchange(String exchange) {
this.exchange = exchange;
}

public Double getBrokerageCharge() {
return brokerageCharge;
}

public void setBrokerageCharge(Double brokerageCharge) {
this.brokerageCharge = brokerageCharge;
}

public Double getPreviousClose() {
return previousClose;
}

public void setPreviousClose(Double previousClose) {
this.previousClose = previousClose;
}

public Double getChnge() {
return chnge;
}

public void setChnge(Double chnge) {
this.chnge = chnge;
}

public Double getChngePer() {
return chngePer;
}

public void setChngePer(Double chngePer) {
this.chngePer = chngePer;
}

public Double getHoldValue() {
return holdValue;
}

public void setHoldValue(Double holdValue) {
this.holdValue = holdValue;
}

public Date getLastTradeDate() {
return lastTradeDate;
}

public void setLastTradeDate(Date lastTradeDate) {
this.lastTradeDate = lastTradeDate;
}

@XmlTransient
public Collection<UserStock> getUserStockCollection() {
return userStockCollection;
}

public void setUserStockCollection(Collection<UserStock> userStockCollection) {
this.userStockCollection = userStockCollection;
}

@XmlTransient
public Collection<UserTrack> getUserTrackCollection() {
return userTrackCollection;
}

public void setUserTrackCollection(Collection<UserTrack> userTrackCollection) {
this.userTrackCollection = userTrackCollection;
}

public CommoditySubCategoryMaster getCommoditySubCategoryID() {
return commoditySubCategoryID;
}

public void setCommoditySubCategoryID(CommoditySubCategoryMaster commoditySubCategoryID) {
this.commoditySubCategoryID = commoditySubCategoryID;
}

@XmlTransient
public Collection<OrderStock> getOrderStockCollection() {
return orderStockCollection;
}

public void setOrderStockCollection(Collection<OrderStock> orderStockCollection) {
this.orderStockCollection = orderStockCollection;
}

@XmlTransient
public Collection<TradeStock> getTradeStockCollection() {
return tradeStockCollection;
}

public void setTradeStockCollection(Collection<TradeStock> tradeStockCollection) {
this.tradeStockCollection = tradeStockCollection;
}

@Override
public int hashCode() {
int hash = 0;
hash += (scripID != null ? scripID.hashCode() : 0);
return hash;
}

@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof ScripMaster)) {
return false;
}
ScripMaster other = (ScripMaster) object;
if ((this.scripID == null && other.scripID != null) || (this.scripID != null && !this.scripID.equals(other.scripID))) {
return false;
}
return true;
}

@Override
public String toString() {
return "entity.ScripMaster[ scripID=" + scripID + " ]";
}

}

what is the cause of this exception? how do i solve it?
Re: Internal Exception: java.lang.NoSuchFieldException [message #875457 is a reply to message #875452] Tue, 22 May 2012 19:30 Go to previous message
Russell Bateman is currently offline Russell BatemanFriend
Messages: 3798
Registered: July 2009
Location: Provo, Utah, USA
Senior Member

On 5/22/2012 1:23 PM, v godara wrote:
> i have a java app that displays data from a table called ScripMaster
> using jpa. i wish to add an extra field to my table but, when i add the
> extra field named 'holdValue' to my database table ScripMaster i get
> following exception, when i remove the field, the app works fine
> Exception [EclipseLink-0] (Eclipse Persistence Services -
> 2.3.0.v20110604-r9504):
> org.eclipse.persistence.exceptions.IntegrityException
> [snip]
>
> what is the cause of this exception? how do i solve it?

This isn't a Java or JPA forum. You might have some success with the
Eclipse data tool forum, but your best bet is probably javaranch or
stackoverflow.
Previous Topic:OS X Shortcut Keys
Next Topic:Eclipse --> Indigo can not update or install plug-ins
Goto Forum:
  


Current Time: Sat Apr 27 03:34:40 GMT 2024

Powered by FUDForum. Page generated in 0.08689 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top