-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: Problem in "hello world" example of book.
PostPosted: Thu Aug 05, 2010 11:59 pm 
Newbie

Joined: Thu Aug 05, 2010 11:49 pm
Posts: 2
Running "hello world" example in book "Java Persistence with Hibernate", Manning edition, (in section "Using Hibernate Entity Manager" -> "Automatic detection of metadata"), i find this exception:
Code:
Exception in thread "main" java.lang.NoSuchFieldError: NONE
   at org.hibernate.ejb.QueryImpl.<init>(QueryImpl.java:604)
   at org.hibernate.ejb.QueryImpl.<init>(QueryImpl.java:79)
   at org.hibernate.ejb.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:268)
   at hello.HelloWorld.main(HelloWorld.java:34)

and the interested line of code of Hello wolrd.java is
Code:
      newEm.createQuery("select m from Message m order by m.text asc").getResultList();

Why?
The code of Message class, HelloWorld.java, persistence.xml is the same of the tutorial on the book. But i don't understand why this exception.
Some help?


Top
 Profile  
 
 Post subject: Re: Problem in "hello world" example of book.
PostPosted: Fri Aug 06, 2010 9:57 am 
Newbie

Joined: Thu Jul 29, 2010 3:43 pm
Posts: 3
> select m from Message m order by m.text asc

There must be a typo.

you are selecting the table name "m" and not the column_name or the wildcard (*)

SQL SELECT Syntax:
SELECT column_name(s) FROM table_name
or
SELECT * FROM table_name

_________________
Thanks
-KB


Top
 Profile  
 
 Post subject: Re: Problem in "hello world" example of book.
PostPosted: Sun Aug 08, 2010 1:48 am 
Newbie

Joined: Thu Aug 05, 2010 11:49 pm
Posts: 2
kboddapati wrote:
> select m from Message m order by m.text asc

There must be a typo.

you are selecting the table name "m" and not the column_name or the wildcard (*)

SQL SELECT Syntax:
SELECT column_name(s) FROM table_name
or
SELECT * FROM table_name

Sorry, but this query is in the manual of Manning.
And the query is not in SQL syntax (methos isn't createSqlQuery(...) ), but in Hibernate syntax.
So, i find a better solution.
Or do i make some mistake?


Top
 Profile  
 
 Post subject: Re: Problem in "hello world" example of book.
PostPosted: Tue Apr 26, 2011 6:09 am 
Newbie

Joined: Tue Apr 26, 2011 5:59 am
Posts: 1
This is a jar dependency issue - check if you have duplicate dependency of any jars.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.