This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Soft Skills and have John Sonmez 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 Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Hibernate" Watch "Hibernate" New topic
Author

Hibernate

poonam dahiya
Greenhorn

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()
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 ]
Paul Sturrock
Bartender

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
Greenhorn

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();
while(i.hasNext())
{-----------
}
ksrk mahidhar
Greenhorn

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

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());
}
session.close();



you will get out put
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Hibernate