• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

entity bean compiling error

 
yuri evan
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic