• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

entity bean compiling error

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi.
I tried to compile the following code from headfirst ejb the Moviebean code with cmr field and getting error.

package headfirst3;

import javax.ejb.*;
import javax.naming.*;
import java.util.*;
import headfirst3.*;

public abstract class MovieBean implements EntityBean {

private EntityContext context;

public abstract String getMovieID();
public abstract Void setMovieID(String i);

public abstract String getTitle();
public abstract void setTitle(String t);

public abstract String getGenre();
public abstract void setGenre(String g);

public abstract int getYear();
public abstract void setYear(int y);


public abstract Director getDirector();
public abstract void setDirector(Director d);


public String getMovieDirectorName() {
return getDirector().getDirectorName();
}


public String ejbCreate(String movieID,String title,int year,String genre,String social) throws CreateException {

setMovieID(movieID);
setTitle(title);
setYear(year);
setGenre(genre);
return null;
}

public void ejbPostCreate(String movieID,String title,int year,String genre,String social)throws CreateException {

try {

InitialContext ctx =new InitialContext();

DirectorLocalHome dirHome =(DirectorLocalHome) ctx.lookup("java:comp/env/ejb/DirectorLocalHome");
Director dir = dirHome.findByPrimaryKey(social);
setDirector(dir);
}
catch(Exception ex) {
context.setRollbackOnly();
ex.printStackTrace();
}

}



public void setEntityContext(EntityContext ctx) {
context =ctx;
}

public void unsetEntityContext() { }
public void ejbLoad() { }
public void ejbStore() { }
public void ejbActivate() { }
public void ejbPassivate() { }
public void ejbRemove() { }


}
error following
movieBean java:25: cannot resolve symbol
symbol:class Director
Location :class Headfirst3.MovieBean
public abstract Director getDirector();
^
movieBean java:26: cannot resolve symbol
symbol:class Director
Location :class Headfirst3.MovieBean
public abstract void setDirector(Director d);
^

moviebean :java:49:cannot resolve symbol
symbol:class directorlocalhome
Location:class headfirst3.MovieBean
DirectorLocalHome dirHome =(DirectorLocalHome) ctx.lookup
("java:comp/env/ejb/DirectorLocalHome");^

MovieBean:java:50:cannot resolve symbol
symbol:class Director
location:class headfirst3.MovieBean
Director dir = dirHome.findByPrimaryKey(social);
^

Before compile MovieBean i compiled DirectorLocal,DirectorLocalHome and DirectorBean and my classpath %J2EE_HOME%\lib\j2ee.jar;%J2EE_HOME%\lib\locale
DirectorLocalHome interface following

package headfirst3;

import javax.ejb.*;


public interface DirectorLocalHome extends EJBLocalHome {

public DirectorLocal create(String social,boolean oscarwinner,int degrees, String directorname)throws CreateException;

public DirectorLocal findByPrimaryKey(String social)throws FinderException;

}

Please help me to fix this.
 
Villains always have antidotes. They're funny that way. Here's an antidote disguised as a tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic