Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6869443
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T03:33:30+00:00 2026-05-27T03:33:30+00:00

I’m modifying inherited code and keep getting a weird cannot find symbol error which

  • 0

I’m modifying inherited code and keep getting a weird “cannot find symbol” error which is throwing me off.

   //======= Error =========

Compiling 1 source file to /Users/Inprimus/Projects/Workspace/Soft/build/web/WEB-INF/classes
/Users/Inprimus/Projects/Workspace/Soft/WebContent/WEB-INF/classes/fr/service/CarPeer.java:49: cannot find symbol
symbol : method addCarToCompany(java.lang.Long,fr.model.company.Car)
location: class fr.dao.CompanyDAO
cmpDAO.addCarToCompany(idCompany,car);
^
1 error

Car peer:

package fr.service;    
import fr.model.company.Car;
import fr.dao.CompanyDAO;
import fr.dao.CarDao;

public class CarPeer {
    private static CarDao carDAO= new CarDao();
    private static CompanyDAO cmpDAO = new CompanyDAO();

    public static void storeCar(Long idCompany, Car car) throws UserServiceException, Exception {
        try {
            cmpDAO.addCarToCompany(idCompany,car);
            System.out.println("Car stored : "+car.toString()+" in "+idCompany);
            carDAO.storeCar(car);
        } catch(DAOException ex) {
            throw new UserServiceException(ex.getMessage(), ex);
        }
    }
}

CompanyDao:

   package fr.dao;
    import fr.model.accounting.Cost;
    import fr.model.company.Car;

    public class CompanyDAO extends GenericDAO<Company> {

    private enum ChildType {
    COST{
    public void addChildToCompany(Company company, Object child) {
    company.addCost((Cost)child);
    }
    },
    CAR{
    public void addChildToCompany(Company company, Object child) {
    company.addCar((Car)child);
    }
    };
    public abstract void addChildToCompany(Company company, Object child);
    }
private void addChildToCompany(Long idCompany, Object child, ChildType type) throws NotFoundDAOException, AlreadyExistDAOException, Exception {
        try {
            // Begin unit of work
            Session session = HibernateUtil.getSessionFactory().getCurrentSession();
            session.beginTransaction();

            Company company = (Company) session.load(Company.class, idCompany);

            type.addChildToCompany(company, child);
            session.flush();

            // End unit of work
            session.getTransaction().commit();

        } catch (ObjectNotFoundException ex) {
            HibernateUtil.getSessionFactory().getCurrentSession().getTransaction().rollback();
            throw new NotFoundDAOException("Identified object " + idCompany
                    + " doesn't exist in database", ex);
        } catch (ConstraintViolationException ex) {
            HibernateUtil.getSessionFactory().getCurrentSession().getTransaction().rollback();
            throw new AlreadyExistDAOException("The new identity already exsits in database", ex);
        } catch (Exception ex) {
            ex.printStackTrace();
            HibernateUtil.getSessionFactory().getCurrentSession().getTransaction().rollback();
            throw new Exception(ex);
        }
    }
    public CompanyDAO() {
    super(Company.class);
    }
    public void addCarToCompany(Long idCompany, Car car) throws NotFoundDAOException, AlreadyExistDAOException, Exception {
    addChildToCompany(idCompany, car, ChildType.CAR);
    }
    }

I have triple checked but can’t find anything wrong with the code thus far. I am building it in Netbeans 7.0.1.I should mention that I get this error when I build, but I can run the web app with no issues whatsoever (yet). But I am worried this may come back to bite in the behind.


I just noticed in the file tree that above the CompanyDAO classes are similarly named files bearing the format: CompanyDAO$ChildType#.class (# corresponds to a number) I’m guessing it hasn’t re-compiled the class to generate the extra child Type I added. How can I effect this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T03:33:31+00:00Added an answer on May 27, 2026 at 3:33 am

    Is CompanyDao being compiled and available on the classpath before CarPeer?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Seemingly simple, but I cannot find anything relevant on the web. What is the
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I have a text area in my form which accepts all possible characters from
Does anyone know how can I replace this 2 symbol below from the string
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.