-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Error reading 'name' on type.. dataTable
PostPosted: Wed Jun 18, 2008 8:33 pm 
Newbie

Joined: Wed Jun 18, 2008 8:28 pm
Posts: 3
Hey, i have ran into a small problem

Code:
javax.servlet.ServletException: /pages/dataTable.jsp(17,13) '#{item.name}' Error reading 'name' on type client.Client$$EnhancerByCGLIB$$11ebbbea
   javax.faces.webapp.FacesServlet.service(FacesServlet.java:256)


My bean is:

Code:
package client;
import java.util.Iterator;
import java.util.List;
import java.util.ArrayList;
import java.util.Set;
import org.hibernate.Hibernate;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.hibernate.cfg.Configuration;


public class getFromDB {

   /**
    * @param args
    */
   private List<Client> clients;
   public String setData() {
      Session session = null;
      String name = "algus";
      //Hibernate.initialize(Client.getName());
      try{
         clients = new ArrayList<Client>();
         // This step will read hibernate.cfg.xml and prepare hibernate for use
         SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory();
         session = sessionFactory.openSession();           
         //Using from Clause
         String SQL_QUERY ="from Client";
         Query query = session.createQuery(SQL_QUERY);
      for(Iterator it=query.iterate();it.hasNext();){
         Client contact=(Client)it.next();         
         
         //Set hobbies = contact.getHobbies();
         //System.out.println("Nimi: " + contact.getName());
          //for (Iterator i = hobbies.iterator(); i.hasNext(); ) {
         
              //Hobby hobby = (Hobby)i.next();
              //System.out.println("Hobi: " + hobby.getName());
          //}   
         clients.add(contact);
      }      
          session.close();
      }catch(Exception e){
          System.out.println(e.getMessage());
      }finally{
      }
      this.clients = clients;
      return "success";
   }
   public List<Client> getClients(){
       return clients;
   }
}



I now know i have to initialize it somehow, but where do i place the code to initialize?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.