• 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
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

Hibernate

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi i m facing a problem i m new to hibernate.
i created the cfg file,hbm file,i am asked to select all the rows from column but i m getting this Error:
No data type for node: org.hibernate.hql.ast.IdentNode +-[ALIAS_REF] IdentNode: 'FIRSTNAME' {alias=FIRSTNAME, no from element}
javascript: x()
Confused

please help me out.i am pasting my cfg file hbm file..too....
thanks in advance...
plzzzzzzzzzzzz help me........




contact.hbm.xml


hibernate.cfg.xml



Contact.java file


[ Edited to use code tags - Paul Sturrock ]
[ June 16, 2008: Message edited by: Paul Sturrock ]
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


String Oracle_QUERY ="Select FIRSTNAME,LASTNAME,EMAILID,ID from Contact";


Contact does not have properties called FIRSTNAME,LASTNAME,EMAILID, or ID. Remember that with HQL you are querying the class not the database table directly.
 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Session session=sf.openSession();
Transaction tx=session.beginTransaction();
RegularLogger.logInfo(RegularDAOImpl.class,"Query of the level_table");
Query q1=session.createQuery("from Contact as l");
List l=q1.list();
Iterator i=l.iterator();
while(i.hasNext())
{-----------
}
 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i am also facing similar problem can any one help me how to workout this issue.
 
ksrk mahidhar
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks i got solution

just use below code

SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory();
session =sessionFactory.openSession();

//Using from Clause
String SQL_QUERY ="from Contact";
Query query = session.createQuery(SQL_QUERY);
for(Iterator it=query.iterate();it.hasNext();){
Contact contact=(Contact)it.next();
System.out.println("ID IS : " + contact.getId());
System.out.println("FirstName IS : " + contact.getFirstName());
System.out.println("LastName IS : " + contact.getLastName());
System.out.println("Email IS: " + contact.getEmail());
}
session.close();



you will get out put
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic