I am new to J2EE development and its frameworks, so I'm leads to create a J2EE application usign Myeclipse,glassfish ans mysql as SGBD ... I need to create a project EJB3 session I have to use Hibernate3 ORM .. My concern is that I've worked with hibernate but in a web project type and not EJB and I really do not know how my project should be like .. I just need to understand the structure of my EJB project because normally we have 2 basic classes: EJBService and EJBserviceRemote .. EJBService, containing all my methods that I would need to call from my client (a web project for exemple) and EJBServiceRemote which contains the signature of each method .. so where do I rank the DAO classes generated by Hibernate ORM and how to call them?? shoukd I copy their code in EJBService and then declare in EJBServiceRemote to be able to call them by my client??

SOS I'm really disturbed

有帮助吗?

解决方案

add all the jars that you're using in your ejb project to the following glassfish directory :

  1. C:/..../glassfish/lib
  2. C:/..../glassfish/domains/"your domain name"/lib

其他提示

Caused by: java.lang.NoClassDefFoundError: org/hibernate/criterion/Criterion

may be you're missing one of the hibernate jars (hibernate-core.jar) or maybe you have an older version of hibernate + a recent one at the same time in your classpath.

ok everything is working now here is my methode to show data:

@SuppressWarnings("unchecked")
  public int[][] afficheProduitsStockList(){

    int j,a;

    ProduitsStockDAO stockdao = new ProduitsStockDAO();
    List<ProduitsStock> LPdt = stockdao.findAll();
    a=LPdt.size();
    int t[][]=new int[a][3];

    Iterator it = LPdt.iterator();

    while(it.hasNext()){
    for(j=0;j<t.length;j++){        
        ProduitsStock pdt = (ProduitsStock)it.next();                   

          t[j][0]=pdt.getCodeStock();
          t[j][1]=pdt.getCodePdt();
          t[j][2]=pdt.getQtePdt();
          } }
    return t;
}

and everything works !

Thank you all :)

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top