| Author |
Message |
|
|
Post subject: Hibernate tutorial -> IllegalStateException
Posted: Jul 14, 2005 - 02:04 PM
|
|
Registered Member


Joined: Jul 10, 2005
Posts: 12
|
|
After working through the hibernate tutorial I deployed the project to the JBOSS 4 folder and get the following exception:
Java.lang.IllegalStateException: No data type for node: org.hibernate.hql.ast.IdentNode
\-[IDENT] IdentNode: 'Vipdata' {originalText=Vipdata}
org.hibernate.hql.ast.SelectClause.initializeExplicitSelectClause(SelectClause.java:136)
org.hibernate.hql.ast.HqlSqlWalker.useSelectClause(HqlSqlWalker.java:440)
org.hibernate.hql.ast.HqlSqlWalker.processQuery(HqlSqlWalker.java:351)
org.hibernate.hql.antlr.HqlSqlBaseWalker.afterQuery(HqlSqlBaseWalker.java:126)
org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:471)
org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:201)
org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:151)
org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:189)
org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:130)
org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:83)
org.hibernate.impl.SessionFactoryImpl.getQuery(SessionFactoryImpl.java:427)
org.hibernate.impl.SessionImpl.getQueries(SessionImpl.java:884)
org.hibernate.impl.SessionImpl.list(SessionImpl.java:834)
org.hibernate.impl.QueryImpl.list(QueryImpl.java:74)
com.nscorp.VipService.getVipdataList(VipService.java:333)
org.apache.jsp.AddVipData_jsp._jspService(org.apache.jsp.AddVipData_jsp:129)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)
I also have two warnings in eclipse:
The serializable class Vipdata does not declare a static final serialVersionUID field of type long Vipdata.java BasicDB/src/com/nscorp
The serializable class VipdataForm does not declare a static final serialVersionUID field of type long VipdataForm.java BasicDB/src/com/nscorp/formbean
Are they related or what am I missing? I'm still to new to Java to understand the relations within the framework, so it's difficult to know where to start looking for the problem.
Does anyone have an idea where to look?
Jean-Marie |
|
|
| |
|
|
|
 |
|
|
Post subject:
Posted: Jul 14, 2005 - 03:17 PM
|
|
Moderator


Joined: Jan 06, 2004
Posts: 23305
|
|
| Quote: |
com.nscorp.VipService.getVipdataList(VipService.java:333)
|
What does the code aruond this line look like?
Also the SerialID warnings are from Eclipse, it's a compiler setting but likely wouldn't hurt to add the IDs. |
_________________ Riyad
MyEclipse Support
|
| |
|
|
|
 |
|
|
Post subject:
Posted: Jul 14, 2005 - 04:07 PM
|
|
Registered Member


Joined: Jul 10, 2005
Posts: 12
|
|
Here is the method:
public List getVipdataList()
{
Session session = null;
try
{
session = HibernateSessionFactory.currentSession();
Query query =
session.createQuery(
"select Vipdata from com.nscorp.hibernate.Vipdata Vipdata order by Vipdata.vipName");
333 return query.list();
}
catch (HibernateException e)
{
System.err.println("Hibernate Exception" + e.getMessage());
throw new RuntimeException(e);
}
finally
{
if (session != null)
{
try
{
session.close();
}
catch (HibernateException e)
{
System.err.println("Hibernate Exception" + e.getMessage());
throw new RuntimeException(e);
}
}
}
}
-------------
I'm reading up on who to add the IDs (hope I find some info on that), thanks.
Jean-Marie |
|
|
| |
|
|
|
 |
|
|
Post subject:
Posted: Jul 14, 2005 - 04:09 PM
|
|
Registered Member


Joined: Jul 10, 2005
Posts: 12
|
|
| Ups, didn't copy the spaces. Just to make sure... the 333 on the line 'return query.list();' is not in the actuall code but just there to point out the line from the error message. |
|
|
| |
|
|
|
 |
|
|
Post subject:
Posted: Jul 14, 2005 - 04:27 PM
|
|
Registered Member


Joined: Jul 10, 2005
Posts: 12
|
|
Regarding: Serialization
They way I understand it from javadoc I'm supposed to set a UID. So I put
static final long serialVersionUID = 42L;
in both classes. Both warnings are gone.
Does its value have to be different in each class? Is there a preference to how the value should look like?
Since this seems to be a requirement you might want to add it to the sample code of the hibernate tutorial, project BasicDB to com.nscopr.formbean.Vipdataform.java and com.nscorp.hibernate.Vipdata.java
Jean-Marie |
|
|
| |
|
|
|
 |
|
|
Post subject:
Posted: Jul 14, 2005 - 04:30 PM
|
|
Moderator


Joined: Jan 06, 2004
Posts: 23305
|
|
You should use the quick fix by Eclipse to generate one for you, the UID helps to identify revisions of classes between serialization states.
Also your query:
| Quote: |
"select Vipdata from com.nscorp.hibernate.Vipdata Vipdata order by Vipdata.vipName"
|
Doesn't make sense to me. This should be something like:
SELECT name FROM VIPData ORDER BY VIPData.id
where "name" and "id" are fields of the VIPData class. Your query as it is written is like saying this in SQL:
SELECT USER_TABLE FROM USER_TABLE ORDER BY USER_TABLE.ID
the first part doesn't make sense. |
_________________ Riyad
MyEclipse Support
|
| |
|
|
|
 |
|
|
Post subject:
Posted: Jul 14, 2005 - 05:22 PM
|
|
Registered Member


Joined: Jul 10, 2005
Posts: 12
|
|
Riyad,
the quick fix worked, thanks...
And you were right, by changing the statement to "SELECT vipName FROM Vipdata ORDER BY vipId" according to the mapping in Vipdata.hbm.xml it worked once but as soon as I wanted to add any data it didn't work anymore even if I redeployed and started over. The message I get now is
org.apache.jasper.JasperException: java.lang.String
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:370)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)
root cause
java.lang.ClassCastException: java.lang.String
org.apache.jsp.AddVipData_jsp._jspService(org.apache.jsp.AddVipData_jsp:153)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)
note The full stack trace of the root cause is available in the Apache Tomcat/5.5.9 logs.
Maybe I should choose a different approach than trying to work with the tutorial?
Jean-Marie |
|
|
| |
|
|
|
 |
|
|
Post subject:
Posted: Jul 14, 2005 - 05:50 PM
|
|
Moderator


Joined: Jan 06, 2004
Posts: 23305
|
|
| The tutorial works fine but the devil is in the details, as you found simply changing the capitalization is the difference between a freak exception and not having one. Your new error should be easier to find (ClassCastException). Loosk like you are doing something in your AddVipData.jsp page that isn't healthy. |
_________________ Riyad
MyEclipse Support
|
| |
|
|
|
 |
|
|
Post subject:
Posted: Jul 14, 2005 - 07:26 PM
|
|
Registered Member


Joined: Jul 10, 2005
Posts: 12
|
|
I guess I'll have to start all over again because it seems to me that I have to fix to much on the sample code that I just copied as is in order for it to work.
If you're saying that the tutorial works fine I must have done something wrong along the way (similar to choosing hibernate 3 instead of 2.x).
Thanks anyway.
Jean-Marie |
|
|
| |
|
|
|
 |
|
|
|
Post subject: No data type for node: org.hibernate.hql.ast.IdentNode
Posted: Aug 30, 2006 - 07:03 AM
|
|

Joined: Aug 30, 2006
Posts: 1
|
|
my client program is.
SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory();
//Open Session
Session session = sessionFactory.openSession();
try{
//Query using Hibernate Query Language
String SQL_STRING = "select TRAINEE_NAME FROM RMG_FEEDBACK";
Query query = session.createQuery(SQL_STRING);
for (Iterator it = query.iterate(); it.hasNext();) {
Feedback feedback = (Feedback) it.next();
System.out.println("User name " + feedback.getTrainee_name() );
System.out.println("User Email " + feedback.getUser_id() );
}
i am getting a exception like this.
log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment).
log4j:WARN Please initialize the log4j system properly.
Exceptionjava.lang.IllegalStateException: No data type for node: org.hibernate.hql.ast.IdentNode
\-[IDENT] IdentNode: 'TRAINEE_NAME' {originalText=TRAINEE_NAME}
plz help |
|
|
| |
|
|
|
 |
|
|
Post subject:
Posted: Aug 30, 2006 - 05:02 PM
|
|
Moderator


Joined: Jan 06, 2004
Posts: 23305
|
|
|
|
|
 |
|
|
Post subject:
Posted: Aug 24, 2008 - 02:15 PM
|
|
Joined: Jul 27, 2008
Posts: 2
|
|
hi, I am searching this tutorial, I have lost link, please somebody can post it here)
thanks. |
|
|
| |
|
|
|
 |
|
|
Post subject:
Posted: Aug 25, 2008 - 06:51 PM
|
|
Registered Member


Joined: Apr 18, 2007
Posts: 5658
|
|
|
|
|
 |
|
|