This week's book giveaway is in the JavaFX forum.
We're giving away four copies of Introducing JavaFX 8 Programming and have Herbert Schildt on-line!
See this thread for details.
The moose likes Object Relational Mapping and the fly likes Hibernate Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Introducing JavaFX 8 Programming this week in the JavaFX forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Hibernate" Watch "Hibernate" New topic


poonam dahiya

Joined: Jun 16, 2008
Posts: 1
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()

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


hibernate.cfg.xml file

[ Edited to use code tags - Paul Sturrock ]
[ June 16, 2008: Message edited by: Paul Sturrock ]
Paul Sturrock

Joined: Apr 14, 2004
Posts: 10336

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.

JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Bhaskar GR

Joined: Jun 13, 2008
Posts: 28
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();
ksrk mahidhar

Joined: Jun 22, 2010
Posts: 9
i am also facing similar problem can any one help me how to workout this issue.
ksrk mahidhar

Joined: Jun 22, 2010
Posts: 9
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);
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());

you will get out put
I agree. Here's the link:
subject: Hibernate
It's not a secret anymore!