This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
So, I'm on my 2nd day of looking at Hibernate. I decided to try a real simple example and code from scratch and I'm totally puzzled at the moment. I have a table in sql server with 3 columns. The primary key is an identity column. the other two columns are simple varchar fields. I'm using Microsoft SQL Server.
I can connect to the database, insert rows, update the rows but when I attempt to do a query an exception is thrown in getImportedClassName(). I have a hibernate.cfg.xml that defines that I have one mapping stored in the TestTable.hbm.xml file. My query looks like this :
List items = session.createQuery("from testtable").list();
is there some other configuration thing that I need to twiddle to make this work? Also, are there particular things to read beside the "Hibernate Reference Doc" and "Hibernate In Action" book for people getting started? I'm using Hibernate 3.1. Thanks.
Joined: Oct 27, 2005
The stack trace on the exception is :
at org.hibernate.hql.ast.ASTQueryTranslatorFactory.createQueryTranslator(ASTQueryTranslatorFactory.java:31) at org.hibernate.impl.SessionFactoryImpl.createQueryTranslators(SessionFactoryImpl.java:410) at org.hibernate.impl.SessionFactoryImpl.getQuery(SessionFactoryImpl.java:469) at org.hibernate.impl.SessionImpl.getQueries(SessionImpl.java:1060) at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1010) at org.hibernate.impl.QueryImpl.list(QueryImpl.java:74)
I've got the following hibernate related jar's in the classpath :