SunScreenCert
asked on
java public access throwing error
i have this new function in custarea1DAO.java in javafiles folder
public BillingDetails getBillingDetails(int appid){
Connection conn = null;
entities.BillingDetails billingDetailsList = null;
String command = "select billingDetailId, billingType, billingRate, billRound from billingdetails where appid = '" + appid + "'";
try {
conn = getConnection();
Statement stmt = conn.createStatement();
if (stmt.execute(command.toSt ring())) {
ResultSet rs = stmt.getResultSet();
while (rs.next()) {
billingDetailsList = new entities.BillingDetails(); //error throwing here
billingDetailsList.setBill ingDetailI d(rs.getIn t("billing DetailId") );
billingDetailsList.setBill ingType(rs .getInt("b illingType "));
billingDetailsList.setBill ingRate(rs .getFloat( "billingRa te"));
billingDetailsList.setBill ingRound(r s.getInt(" billRound" ));
}
}
}catch (Exception e) {
// TODO: Handle
e.printStackTrace();
} finally {
if (conn != null) {
try {
conn.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}
return billingDetailsList;
}
and i have this file BillingDetails.java in entities folder
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package entities;
/**
*
* @author Administrator
*/
public class BillingDetails {
BillingDetails(){
billingDetailId = 0;
billingType = 0;
billingRate = 0.0f;
}
private Integer billingDetailId;
private Integer billingType;
public Float getBillingRate() {
return billingRate;
}
public void setBillingRate(Float billingRate) {
this.billingRate = billingRate;
}
public Integer getBillingRound() {
return billingRound;
}
public void setBillingRound(Integer billingRound) {
this.billingRound = billingRound;
}
public Integer getBillingType() {
return billingType;
}
public void setBillingType(Integer billingType) {
this.billingType = billingType;
}
private Float billingRate;
private Integer billingRound;
public Integer getBillingDetailId() {
return billingDetailId;
}
public void setBillingDetailId(Integer billingDetailId) {
this.billingDetailId = billingDetailId;
}
}
now in the line commented it is throwing the errror that BillingDetails is not public in entities, it cannot be accessed outside the package. Can you please help me here
public BillingDetails getBillingDetails(int appid){
Connection conn = null;
entities.BillingDetails billingDetailsList = null;
String command = "select billingDetailId, billingType, billingRate, billRound from billingdetails where appid = '" + appid + "'";
try {
conn = getConnection();
Statement stmt = conn.createStatement();
if (stmt.execute(command.toSt
ResultSet rs = stmt.getResultSet();
while (rs.next()) {
billingDetailsList = new entities.BillingDetails();
billingDetailsList.setBill
billingDetailsList.setBill
billingDetailsList.setBill
billingDetailsList.setBill
}
}
}catch (Exception e) {
// TODO: Handle
e.printStackTrace();
} finally {
if (conn != null) {
try {
conn.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}
return billingDetailsList;
}
and i have this file BillingDetails.java in entities folder
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package entities;
/**
*
* @author Administrator
*/
public class BillingDetails {
BillingDetails(){
billingDetailId = 0;
billingType = 0;
billingRate = 0.0f;
}
private Integer billingDetailId;
private Integer billingType;
public Float getBillingRate() {
return billingRate;
}
public void setBillingRate(Float billingRate) {
this.billingRate = billingRate;
}
public Integer getBillingRound() {
return billingRound;
}
public void setBillingRound(Integer billingRound) {
this.billingRound = billingRound;
}
public Integer getBillingType() {
return billingType;
}
public void setBillingType(Integer billingType) {
this.billingType = billingType;
}
private Float billingRate;
private Integer billingRound;
public Integer getBillingDetailId() {
return billingDetailId;
}
public void setBillingDetailId(Integer
this.billingDetailId = billingDetailId;
}
}
now in the line commented it is throwing the errror that BillingDetails is not public in entities, it cannot be accessed outside the package. Can you please help me here
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.