Re: Need help with SQL query

View: New views
2 Messages — Rating Filter:   Alert me  

Parent Message unknown Re: Need help with SQL query

by supun liyanage :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

hi Vieraci,

I think you have to include the SQL statement in the createQuery function, and below mighty be a good reference to you.

http://weblogs.java.net/blog/mb124283/archive/2007/04/java_persistenc.html

regards

Don Supun M.A. Liyanage
NB Community Doc  Contributer 
NB UML Developer

vieraci <vince@...> wrote:

This statement:

Statement stmt = myConn.createQuery();

I get this error in the popup where the red (!) is displayed to the left of
the statement in the Netbeans 6.1 IDE

createQuery(java.lang.string) in javax.persistence.EntityManager cannot be
applied to incompatible types
Found javax.persistence.EntityManager.createQuery
required: com.mysql.jdbc.Statement

Driver is mysql-connector-java-5.1.5 (Revision ${svn revision})
myConn is an EntityManager bean
Even if I give the complete name (com.mysql.jdbc.Statement stmt = ) is same
error.

Why is this so ?

--
View this message in context: http://www.nabble.com/Need-help-with-SQL-query-tp16993146p16993146.html
Sent from the Netbeans - J2EE mailing list archive at Nabble.com.



Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now.

Parent Message unknown Re: Need help with SQL query

by David Van Couvering-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

You have to provide your SQL query string as a parameter to createQuery
()

------------------
David Van Couvering
http://davidvancouvering.blogspot.com

On May 1, 2008, at 1:08 AM, vieraci <vince@...> wrote:

>
> This statement:
>
> Statement stmt = myConn.createQuery();
>
> I get this error in the popup where the red (!) is displayed to the  
> left of
> the statement in the Netbeans 6.1 IDE
>
> createQuery(java.lang.string) in javax.persistence.EntityManager  
> cannot be
> applied to incompatible types
> Found javax.persistence.EntityManager.createQuery
> required: com.mysql.jdbc.Statement
>
> Driver is mysql-connector-java-5.1.5 (Revision ${svn revision})
> myConn is an EntityManager bean
> Even if I give the complete name (com.mysql.jdbc.Statement stmt = )  
> is same
> error.
>
> Why is this so ?
>
> --
> View this message in context: http://www.nabble.com/Need-help-with-SQL-query-tp16993146p16993146.html
> Sent from the Netbeans - J2EE mailing list archive at Nabble.com.
>