wood burning stoves 2.0*
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 Murach's Java Servlets and JSP this week in the Servlets 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........



Contact.java 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)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());

you will get out put
I agree. Here's the link: http://aspose.com/file-tools
subject: Hibernate
Similar Threads
it is giving fatal exception
cannot insert record in MS SQLServer 2000
Data getting saved in session, but not being persisted in table.
Batch Update Failure
data insert error